& Lt;/pre & gt; & lt; prename & quot; code & quot; class & quot; javascript & quot; & gt; /** there are two types of page loading events: ready, indicating that the file structure has been loaded (excluding non-text media files such as images) and onload, indicates that all elements on the page including images and other files are loaded...
/*
* There are two types of page loading events: ready, indicating that the file structure has been loaded (excluding non-text media files such as images ),
* The second is onload, which indicates that all elements, including images and other files, on the page are loaded. (You can say: ready loads before onload !!!)
* Window. onload cannot be written at the same time. If there are multiple window. onload methods, only one
* $ (Document). ready () can be compiled at the same time and executed
* $ () Is short for $ ("document"). ready () method
*
* The following code pops up first: hello and then: test2
*/
Function test1 (){
Alert ("test1 ");
}
Function test2 (){
Alert ("test2 ");
}
Window. onload = test1;
Window. onload = test2;
/**
* To execute both functions: window. onload = function (){
Test1 ();
Test2 ()
}
*/
$ (Function (){
Alert ("hello ");
})
/**
* Differences between jquery and javascript variables: by default, when defining jquery object variables, you should add a $ variable before the variable
Differences between javascript Variables
*/
Var $ div = $ ("div"); // jquery variable
Var div = document. getElementsByTagName ("div"); // javascript Object variable
Window. onload = function (){
Var dom = document. getElementsByTagName ("");
For (var I = 0; I
Dom [I]. onclick = function (){
Alert ("hello ");
}
}
}
Script
From all the way to the North