First, JS delayed Loading
The Code is as follows:
Copy codeThe Code is as follows:
<Script language = "JavaScript" src = "" id = "my"> </script>
<Script language = "JavaScript">
SetTimeout ("document. getElementById ('my'). src = 'include/... file... php';", 3000); // delay of 3 seconds
</Script>
Second, the final loading of JS
Insert the following code where Javascript is to be inserted:
<SPAN id = L4EVER> LOADING... </SPAN>
Of course, the LOADING... You can switch to your favorite small image. It looks very AJAX-effective.
Insert at the bottom of the page:
Copy codeThe Code is as follows:
<SPAN class = spanclass id = AD_L4EVER>
Your JS Code is here! </SPAN>
<Script> L4EVER. innerHTML = AD_L4EVER.innerHTML; AD_L4EVER.innerHTML = ""; </script>
Third, JS final loading
Position of the advertisement to be displayed
<Div id = "guangg1"> </div>
Ad content to be displayed
Copy codeThe Code is as follows:
<Div id = "ggad1" style = "display: none">
<Script language = "javascript" src = "/include/...... js"> </script>
</Div>
Determine whether the ad location to be displayed exists
Copy codeThe Code is as follows:
<Script language = "javascript">
Function chkdiv (divid ){
Var chkid = document. getElementById (divid );
If (chkid! = Null)
{Return true ;}
Else
{Return false ;}
} Finally, the advertisement is displayed.
If (chkdiv ('guangg1 ')){
Document. getElementById ('guangg1 '). innerHTML = document. getElementById ('ggad1'). innerHTML;
Document. getElementById ('ggad1'). innerHTML = "";
}
</Script>
SetTimeout usage
The standard syntax of setTimeout is: setTimeout (expression, time (MS.
Note the call of the first parameter as a function. Assume It is a function.
1. The function has no parameters:
Function alertV () {alert ("000 ");}
When the first parameter is not enclosed by quotation marks ("" or ''), the delay is one second:
SetTimeout (alertV, 1000 );
When the first parameter is enclosed by quotation marks, the delay is one second:
SetTimeout ("alertvs ()", 1000 );
2. function parameters:
Function alertV (event) {alert ("keyCode =" + event. keyCode );}
Set this parameter:
SetTimeout (function () {alertV (event) ;}, 1000); otherwise, the system will prompt that the parameter is not defined.