I m using the following script to call a onload function but it does not works in IE
("#body").attr({onload : "calFact();"});
on( "load", handler ) . The load event is sent to an element when it and all sub-elements have been completely loaded. This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the window object.
In JavaScript, this event can apply to launch a particular function when the page is fully displayed. It can also be used to verify the type and version of the visitor's browser. We can check what cookies a page uses by using the onload attribute.
The Load function initializes a database and loads it from an input data file. It can be used for initial loading of a database, as part of a database reorganization, or for reloading a database after changing the DBD definition.
$( document ).ready()A page can't be manipulated safely until the document is "ready." jQuery detects this state of readiness for you. Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute.
If you are using jQuery you could use the ready()
function like so:
$(function() {
callFact();
});
or even more simply, just pass the method to jQuery:
$(callFact);
That will fire as soon as the DOM is available to manipulate, sometimes earlier than onload
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With