-related functions, so that window.onload can provide a "load" function, or the content of the page is very small, completely without document.ready (); According to various circumstances, should be reasonable use of onload and ready.
Use onload to load:
Copy Code code as follows:
Window.onload=function () {
var currentrenderer = ' JavaScript ';
Fusioncharts.setcurrentrenderer (Currentrenderer
Onload indicates that all dom elements have been created, after the image and css are added, ready is triggered after the dom element is created. Therefore, jquery ready can improve the webpage response speed;
Jquery: ready standard syntax:
The Code is as follows:
$ (Document). ready (function (){Alert ("loading ended ");});
A $ (document) converts the document of a dom object to a jquery object, and th
Assume two functions: firstFunction and secondFunction. What should I do if I want these two functions to be executed during page loading? If they are gradually bound to the onload event, they will be executed only when the last one is:
Window. onload = firstFunction;
Window. onload = secondFunction;
SecondFunction will replace firstFunction. You may think that e
Recently, when I changed a page embedded in the frame, jquery was used for the effect, and the page itself was bound with the onload event. After the change, the test in Firefox is normal and smooth. in IE, it takes more than a dozen seconds for jquery to show up, and daylily is getting cooler.
At first, we thought it was a conflict with the onload loading method. $ (Document) is widely used on the Inte
Page loading completed there are two kinds of events, one is ready, indicating that the document structure has been loaded complete, Onload,ready concept is easy to confuse, the following for everyone in detailPage loading completed there are two kinds of events, one is ready, indicating that the document structure has been loaded complete (not including pictures and other non-text media files), the second is onlo
Need to get the height of the div, often need to use offsetheight, sometimes encounter offsetheight get to 0 of the phenomenon, interested friends can refer to the following code fragment
In the use of IE, especially in the current div+css way, often do not define the height of Div, this is added div content, need to get the height of Div, often need to use offsetheight.In use, sometimes encounter offsetheight get to 0 of the phenomenon, but if you use a variety of JS Debugging Tools debugging,
In the past two days, a simple Image Viewer is created, where "Previous Page" and "next page" are used, new image () is used for Image loading, and the src attribute of image is set, everything works normally in Google Chrome/Opera/FireFox. The Code is as follows:
Copy to ClipboardReference: [www.bkjia.com] var I = new Image ();
I. src = _ this. settings. imgs [_ this. currIndex];
// Baidu. dom. show (baidu. dom. query (selectPre + '# loading') [0]);
I. onlo
About the onload event of the Image object.
What you want to obtain is the width and height of the image. Therefore, the onload method is used. In addition, the remote image is obtained.
However, when IE displays the image for the second time, the onload method is always not used. Code:
Var img = new Image ();
Img. src = "loading.gif ";
Img.
Window. onload must have been used by everyone. It is executed during window loading. How can we determine if window. onload is used multiple times? Next, I will share with you a method window. onload that must have been used by everyone. It is executed during window loading. How can we determine if window. onload is u
In the past two days, a simple image Viewer is created, where "Previous Page" and "next page" are used, new image () is used for image loading, and the src attribute of image is set, everything works properly in Google Chrome/Opera/Firefox;CodeAs follows:
1 VaR I = New Image (); 2 I. src = _ This. settings. IMGs [_ this. currindex]; 3 // Baidu. Dom. Show (Baidu. Dom. Query (selectpre + '# loading') [0]); 4 I. onload = Function (){ 5 Image.
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, including images, are loaded. (You can say: ready loads before onload !!!)Generally, the style is controlled, and the slice size is controlled to be loaded in onload;The jS
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, including images, are loaded. (You can say: ready loads before onload !!!)
Generally, the style is controlled, and the slice size is controlled to be loaded in onload;
The
when using onload to get an element, it is recommended that you define the name of the element you want to get before the OnLoad event, and that only the fetch operation is performed in OnLoad, so that the acquired element will be used successfully later.DOCTYPE HTML>HTMLLang= "en">Head> Metahttp-equiv= "Content-type"content= "text/html"CharSet= "UTF-8"> ti
Original source
First Page_Load is a method, and onload is a method.
OnLoad is the page class inherits from System.Web.UI.TemplateControl, and System.Web.UI.TemplateControl inherits from System.Web.UI.Control. So strictly speaking, the onload is a method that belongs to System.Web.UI.Control.
Also page has a load event that is also the same inherited from System.
Copy codeThe Code is as follows :/*
1. obj is equivalent to window
2. type is equivalent to onload
3. fn is equivalent to an anonymous Function
*/
Function addEvent (obj, type, fn ){
Var saved = null; // The user saves the previous event
If (typeof obj ["on" + type] = "function "){
Saved = obj ["on" + type]; // The user saves the previous event.
};
// Execute the event
Obj ["on" + type] = function (){
If (saved ){
Saved ()
};
Fn ();
};
Wait for the page to finish loading before executingExecutes a piece of JavaScript immediately after the page is loaded:onload="load()">Try it yourself.Browser support
IE
Firefox
Chrome
Safari
Opera
The OnLoad property is supported by all major browsers.Definition and usageThe OnLoad property is triggered when an object i
Yesterday, we used the jQuery plug-in aeImageResize to find it more advantageous: after each image is loaded, it will immediately perform proportional scaling.This is attributed to the onload of the Image object loading event.Check the source code of the plug-in and find that it also depends on the complete attribute of the image object and the onload event, and especially treats IE6 differently. In the end
The onload event about the Image object.What you want to get is the width and height value of the image. So use the OnLoad method. In addition, a remote picture is obtained.But IE in the second display of pictures, always do not go to the OnLoad method. Code:
var img = new Image ();
IMG.SRC = "Loading.gif";
Img.onload = function () {
var iheight = img.height
Yesterday, with the jquery plug-in aeimageresize, found that it has more advantages: each picture after loading, will be immediately to zoom.
This is attributed to the loading event of image object image onload.
View the source of the plug-in, found that it also relies on the image of the object's complete properties and onload events, and particularly IE6 differentiated treatment, in the end IE6 in the pic
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.