<Head>
<SCRIPT>
$ (Document). Ready (function (){
Alert ("");
VaR wait = Document. getelementbyid ("wait ");
If (wait) Wait. style. Visibility = "hidden ";
$ ("Iframe"). Load (function (){
Alert ("B ");
VaR wait = Document. getelementbyid ("wait ");
If (wait) Wait. style. Visibility = "hidden ";
});
});
</SCRIPT>
<Head>
<Body>
<IFRAME src = "url">
</Body>
--- Analyze the code above
1. After the page is loaded, execute alert ("A") and bind an event to IFRAME. But alert ("B") is not executed. The cause is that IFRAME has been loaded when the page is loaded. To be more IFRAME
When you do not reload the entire page, that is, if you do not execute alert ("A"), alert ("B") is executed ");
2. If $ ("iframe"). Load (function (){
Alert ("B"); var wait = document. getelementbyid ("wait"); If (wait) Wait. style. visibility = "hidden";}); after the <body> label <IFRAME> label
Will Execute alert ("B"); because the event is bound when IFRAME is not loaded.
Page loading and IFRAME loading Functions