JS jquery Page Load Initialization method
A. js page load Initialization method
// 1. Write the initialization method inside the body .<Bodyonload= ' init () '></Body><Scripttype= "Text/javascript"> function init (){ //Initialize content }</Script>
// 2.window.onload=function () {} <Scripttype= "Text/javascript">window.onload=function(){ //Initialize content }</Script>
//3. Write initialization method, page order execution to initialize method when initialized < type= "Text/javascript"> function init () { Initialize content }; </ Script >
Two. jquery page load Initialization method
//1.$.function () {} < script type = "text/ JavaScript " > $. function () { // initialize content }); </ script >
//2.$ (document). Ready (function () {}) < script type = "Text/javascript" > $ (document). Ready ( function () { // initialize content }); </ script >
//3.jQuery (function ($) {}) < type= "Text/javascript"> jQuery (function($) { // Initialize content }); </ Script >
Three. The difference between jquery and JS initialization loading pages
jquery: Wait for the page to finish loading data, as well as part of the page elements (excluding pictures, videos),
JS: It is the full loading of the page before performing the initialization load.
JS jquery Page Load Initialization method