एचटीएमएल व्यू इवेंट प्रॉपर्टी उस विंडो ऑब्जेक्ट में एक उद्धरण लौटाती है जहां घटना हुई थी।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
event.view
उदाहरण
आइए HTML व्यू इवेंट प्रॉपर्टी का एक उदाहरण देखें -
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
background-color: #FBAB7E;
background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
text-align: center;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
</style>
<body>
<h1>HTML view Event Property</h1>
<button class="btn" onclick="get()">Show view event</button>
<div class="show"></div>
<script>
function get() {
document.querySelector(".show").innerHTML = "Open your console and observe the Window object";
console.log(event.view);
}
</script>
</body>
</html> आउटपुट

"इवेंट देखें दिखाएं . पर क्लिक करें "विंडो ऑब्जेक्ट प्रदर्शित करने के लिए बटन -

अब विंडो ऑब्जेक्ट देखने के लिए अपना कंसोल खोलें -
