JS Event Source Window.event.srcElement

Source: Internet
Author: User

One good thing is that I want some object in the body (or other element) to respond to events without asked to write as long as the outer layer writes a Then check that event.srcElement.tagName or other attributes are not what you want to decide whether to respond to events or not. But it's like event.srcelement doesn't work in ff.</p><p> such as </p><p><input value= "input" ><br><span>span</span></ The P><div>div</div><p>event object refers to the event object that is currently triggered, and window.event.srcElement refers to the object that triggered the event. For example you set document.onclick = MyFunc;
At this point all the page click events are given to myfunc processing, in the MyFunc function can write VSRC =window.event.srcElement, know the user is clicked what place, do the corresponding processing. You find an HTML file that adds this paragraph:</p><p><textarea rows= "Ten" cols= "All" > <script Languange = "JavaScript" >Document.onclick=MyFunc; functionMyFunc () {alert (window.event.srcElement.tagName); } </script> </textarea> <script Languange = "JavaScript" >Document.onclick=MyFunc; functionMyFunc () {alert (window.event.srcElement.tagName); } </script></p><p> I'll see if I try. <a href=#>void(0) is a function that does nothing. </a></p></body>

JS Event Source Window.event.srcElement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.