First JS lazy loading
<script> <br>
setTimeout("document.getElementById('my').src='include/common.php'; ",3000);//Delay 3 seconds <br>
</script>
Under normal circumstances, setTimeout is used to achieve
The second JS is loaded last
Insert the following code where JS needs to be inserted:
LOADING...
Of course, that LOADING... you can change it to a small picture you like. It looks very AJAX effective.
Then insert at the bottom of the page:
js code
<script>L4EVER.innerHTML=AD_L4EVER.innerHTML;AD_L4EVER.innerHTML="";</script>
The standard syntax of setTimeout is: setTimeout(expression, time (milliseconds)) two parameters.
Here, focus on the call when the first parameter is a function, assuming it is a function.
1. Function without parameters:
function alertV(){ alert("000"); }
When the first parameter is not quoted ("" or ''), there is a one second delay:
setTimeout(alertV,1000);
When the first parameter is quoted, delay for one second:
setTimeout("alertV()",1000);
2. The function has parameters:
function alertV(event){ alert("keyCode=" event.keyCode); }
At this time it should be set to:
setTimeout(function(){alertV(event);},1000); Otherwise, it will prompt that the parameter is undefined.
setTimeout(function () {
$("#id").html(datastr);
}, 1000);
Copy after login
jquery is implemented through delay, such as
$("#id").delay(1000).html(datastr);
Copy after login
setTimeout('yourFunction()',5000); Execute yourFunction() after 5 seconds, only once
setInterval('yourFunction()',5000); Execute u
every 5 seconds
If setTimeout('yourFunction()',5000) is called again in yourFunction(), you can complete something similar to
The function of setInterval('yourFunction()',5000)
If anyone has a better and feasible method, thank you for sharing.