First JS delayed Loading
Copy codeThe Code is as follows:
<Script language = "JavaScript" src = "" id = "my"> </script>
<Script>
SetTimeout ("document. getElementById ('My '). src = 'include/common. php';", 3000); // delay of 3 seconds
</Script>
Generally, setTimeout is used for implementation.
Final loading of second JS
Insert the following code where Javascript is to be inserted:
Copy codeThe Code is as follows:
<SPAN id = L4EVER> LOADING... </SPAN>
Of course, the LOADING... You can change to a small image you like. It looks very AJAX.
Insert at the bottom of the page:
Copy codeThe Code is as follows:
<SPAN class = spanclass id = AD_L4EVER> <script src = "1.js"> </script> </SPAN>
Js Code
Copy codeThe Code is as follows:
<Script> L4EVER. innerHTML = AD_L4EVER.innerHTML; AD_L4EVER.innerHTML = ""; </script>
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.
If anyone has a good method, thank you for sharing it.