It works fine in IE and Opera Effective, except that FF neither executes nor reports an error, because in FF, document.body.onload is undefined (undefined), and nothing will happen if a function is assigned to undefined, nor is it an error. This is valid in IE, Opera and FF:
[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute ] About using scripts Bind event handle
Use attachEvent under IE, and use addEventListener under FF The relevant discussion is as follows: http://search.blueidea.com/?q=addEventListener&bisearch= bbs
(You can basically understand it after reading a few posts, so I won’t go into details. Please don’t comment on old posts when reading, thank you) Reference link: http://bbs.blueidea.com/viewthre ... p;page=1#pid2248824 http://bbs.blueidea.com/viewthread.php?tid=2507914 About floating codes and documentElement / body
People often ask why floating ads / couplet codes cannot be used under xHTML 1.1 DTD file header / FF This is because, according to the standard For example, the scroll bars of the form we see should not be of body, but of HTML (that is, document.documentElement object)So, the solution is to put the previously non-standard code into document.body .scrollTop or similar code is transformed into document.documentElement.scrollTop Regarding the reference of ID and html object elements
There are many reasons for this problem. But a basic prerequisite is that for IE, the ID of an HTML element can be used directly as a variable name in a script, but not in FF. Copy code
The code is as follows:
Copy code
The code is as follows:
About the differences in the use of event objects In IE, when an event is triggered, there is a global window.event object that saves event-related information
IE Only
[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute <script>
document.body.onload=function(){alert("!")}
</script>]<script>
window.onload=function(){alert("!")}
</script> FF 中,事件激发的时候,将一个局部的 event 对象作为第一个参数传递给了事件处理函数 FF Only
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn