JS OnLoad event does not work sample analysis _javascript tips

Source: Internet
Author: User
The previous incident encountered a strange problem, JSP page to write a onload event, found incredibly does not work, view source files, Bady after the onload unexpectedly no method name???

<body onload= "This is actually empty" bottommargin= "0" leftmargin= "0" topmargin= "0" rightmargin= "0" >

Baffled,

So the experiment
Copy Code code as follows:

</body>
< script language= "JavaScript" >
Window.onload = GetState ()
</script>

It's no problem ... what is this for??

It turns out to be <script src= "<%=path%>/js/sorttable.js" ></script>

The introduction of this JS has a damn window.onload = Sorttable.init; This js is used in other pages, online down a table operation JS.

At least give you a hint, it is likely that other places have been used, causing conflict!

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.