Method 1:
Copy code code as follows:
Window.onload = function () {
Var name = document.GetelementByid ("name"). Val (); // Load html, and load all the reference files (pictures, CSS styles, JS, etc.)
}
Method 2: You need to introduce jQuery's .js file
Copy code code as follows:
$ (docume) .Ready (function () {{) {
Alert ("" jquery's first entry case "); // Load html, no need to wait, load immediately
});
Method 3: (equivalent to method 2)
Copy code code as follows:
jQuery (function () {
if ($ ("input [name = 'message']). Val ()! =" ")
alert ($ ("input [name = 'message']). Attr (" value ");
});
Method 4: (equal to above)
Copy code code as follows:
$ (function () {
alert ("Jquery page automatically loaded 1 ....");
});
Method 5-1: Loading of Window.onload event (multiple functions are loaded at the same time when the page is loaded ...)
Copy code code as follows:
<html>
<body only = "function1 (), function2 (), function3 ()"> ">
</body>
</html>
<script>
function1 () {
}
function2 () {
}
function3 () {
}
</script>
Method 5-2: Loading the Window.Onload event (multiple functions are loaded at the same time when the page is loaded ...)
Copy code code as follows:
<html>
<body>
</body>
<html>
<script>
function1 () {
}
function2 () {
}
function3 () {
}
window.onload = function () {
function1 ();
function2 ();
function3 ();
}
</script>