Here, the result is assigned to him. The above is executed on IE, And the execution on Firefox is the correct result, that is, 1 --> -- 2> loading the body. The output result is what we want,
But IE is the above result 1 -- load the body, 2 is not displayed, the result is still null, It is speechless. In addition, an error is reported during debugging.Window. onload = f; this sentence has not been implemented yet. Alert ('2') is not executed because of a problem. Window. onload is of the object type by default and its value is null. Window. onload IE treats him as the object type, but Firefox treats him as an undefined type and is a keyword in IE. A type not defined in a browser is equivalent to a global variable. It turned out to be the difference between IE and Firefox.
1. Firefox does not support function names for adding events to objects. For example, the following code can be normally displayed in IE, but not in Firefox;
Function. Window. onload (){
Alert ("onLoad ");
}
To use:
Window. onload = fnshow;
Function fnshow (){
Alert ("onLoad ");
}
Or directly write as follows:
Window. onload = function (){
Alert ("onLoad ");
}
//-------
, Here window. onload is a function that is executed only when page loading is complete. The result should be: 2 --.> this is my XHTML page --> 1, window. onload is a function type.