Test environment:
Windows XP SP3
Safari 4.0.5
Safari 5.0
Create an HTML file with the following content:
Drag this file into safari and Safari will be "dead "......
Cause: if the initial src attribute is null or the IFRAME element of "about: blank", Safari will die if its onload event contains functions such as alert, confirm, and prompt.
Solution: Do not leave the src attribute blank, or do
The manipulation of elements and the binding of events need to wait for a suitable time to see the following example:DOCTYPE HTML>MetaCharSet= "Utf-8">HTML>Head> title>1-1title> Scripttype= "Text/javascript">document.getElementById ("Panel"). onclick= function() {alert ("The element has been loaded!"); } /*Execution Error*/ Script>Head>Body>DivID= "Panel">Click Me.Div>Body>HTML>If so, the bi
Today, I encountered a very interesting question in the group. There are a wide variety of answers that everyone can give. Specially organized into blog posts:
// Original question: window. alert = function () {}; ______; alert (1); fill in the blanks to make the following alert (1) pop up correctly. At least two different ideas are listed.
Solution 1: Create
)//return false in non IEWindow.attachevent ('onload', Jian);ElseWindow.addeventlistener ('Load', Jian,false);//AddEventListener method to load event binding functionfunctionAdd () {alert ('the value of 1+2 is 3! ');}functionJian () {alert ('a value of 3-2 is 1! ');}functionCheng () {alert ('the value of 3*5 is 15! ');
Example of alert pop-up prompt box in the basic JavaScript tutorial, basic tutorial alert
A prompt box is displayed for the alert command.
This section provides several simple examples for beginners to learn JavaScript. The following code is an example of a pop-up prompt box
OnLoad Eventhtml> head> title>Test04.htmltitle> script type="Text/javascript"> varCount=5; function show(){ for(varI=0; i"Hello world!); } } function show2(){Count=prompt ("Please enter the number of times:",""); Show (); }//Assign the definition of a function to a variable and call the function by calling the variable varv1= function (){
the front.
$ (document). Three abbreviations for Ready ()
$ (document). Ready (Handler)$ (). Ready (handler)//(this isn't recommended)$ (handler)
Window objects and Document objects
The Window object represents the windows open in the browser: http://www.w3school.com.cn/jsref/dom_obj_window.aspThe Document object represents the HTML document that is loaded into the browser: http://www.w3school.com.cn/jsref/dom_obj_document.asp
Event Object
Event is a state of affairs that represents vario
JQuery $ (document). ready () and JavaScript onload events, jquery. ready
To bind element operations and events, you need to wait for a proper time. See the following example:
In this case, the event is bound before the element is loaded,The browser Console reports the following error: TypeError: document. getElementById (...) is null to change the time. The following three programs can successfully bind e
This article mainly introduces window. onload and $ (document ). the difference between ready () and the example analyzes the differences between the two in the use of page elements. For more information, see the example in this article. onload and $ (document ). ready. Share it with you for your reference. The specific analysis is as follows:
Window. onload i
Window. onload is often used for projects, but window. onload cannot load multiple functions at the same time. The usage is as follows:
Function func () {alert ("this is window onload event! "); Return ;}
Window. onload = func;
Or:
Window.
reduced, and the picture is cropped. Need to load all the content of the Web page before executing it? I recommend using the $ (window). Load () method, which will wait until all the pages have been loaded and not be triggered without the drawbacks of the onload event.The code above will be executed sequentially after all the page contents have been loaded.Of course, don't forget the corresponding unload method.$ (window). Unload (function () {
This article mainly introduces window. onload and $ (document ). the difference between ready () and the example analyzes the differences between the two in the use of page elements. For more information, see the example in this article. onload and $ (document ). ready. Share it with you for your reference. The specific analysis is as follows:
Window. onload i
.
$ (Document ). the ready () method can be used multiple times to register different event handlers, while the window. onload can only store reference to one function at a time. Multiple binding functions only overwrite the previous functions.First, let's take a look at the results of the window. onload method registering twice on a page:
Function one (){
Alert
I have previously written a Js function for proportional scaling of images. The defect is that proportional scaling can be performed only after all images are loaded. 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 d
$ (window). Load () method, which will wait until all the contents of the page have been loaded before triggering, and without the drawbacks of the onload event.The above code executes sequentially after all of the page's contents have been loaded.Of course, don't forget the Unload method that corresponds with it$ (window). Unload (function () {Alert ("Good Bye");});The above code is raised when the page c
(document.all) {Window.attachevent (' onload ', func1);Window.attachevent (' onload ', FUNC2);} else {Window.addeventlistener (' Load ', func1, false);Window.addeventlistener (' Load ', FUNC2, false);}
Is there any other way besides the above method?
Usage is as follows:
The code is as follows
Copy Code
function func () {alert
This article mainly introduces how to dynamically create the script tag onload in IE8, which involves adjustments to the javascript loading sequence and has some reference value, for more information about how to dynamically create the script tag onload in IE8. Share it with you for your reference. The specific analysis is as follows:
During the project today, I
This article mainly introduces how to dynamically create the script tag onload in IE8, which involves adjustments to the javascript loading sequence and has some reference value, for more information about how to dynamically create the script tag onload in ie8. Share it with you for your reference. The specific analysis is as follows:
During the project today, I
$ (window). Load () method, which will wait until all the contents of the page have been loaded before triggering, and without the drawbacks of the onload event.The above code executes sequentially after all of the page's contents have been loaded.Of course, don't forget the Unload method that corresponds with it$ (window). Unload (function () {Alert ("Good Bye");});The above code is raised when the page c
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.