Add click event for body tag and document.body only Firefox pops up two times _javascript tips

Source: Internet
Author: User
This is a vegetable dish just found.
<! DOCTYPE html> <ptml > <pead> <meta charset= "gb2312" > <title> to the body tag and document.body all add click events only after Firefox pops up two times </title> </pead> <body onclick= "alert (1)" > <p>html body</p> <script> ; Document.body.onclick=function () {alert (' body '); }; </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

1, add the onclick event to the body tag, pop 1
2, add the onclick event to document.body, pop the body
Click on the red area of the page
Ie6/7/8/9/safari/chrome/opera: Don't play any news

Firefox: Eject 1

Click on the yellow area of the page

Ie6/7/8/9/safari/chrome/opera: Pop-up Body

Firefox: Pop the body, then play 1

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.