jQuery定时、延迟加载

jQuery定时加载
<html>
<head>
<script src="jquery.js" type="text/javascript"></script>
<script>
$(document).ready(
    function () 
    {
        //定时执行SetMsgValue函数
        setInterval("SetMsgValue()",50);
    }
 );

function SetMsgValue()
{
    //向<div id="Msg">中追加内容
    $("#Msg").append((new Date()).toString());
}
</script>
</head> 

<body>  
<div id="Msg">If you click on me, I will disappear.</div>
</body>

</html> 

jQuery延迟加载


只需将setInterval函数改为setTimeout即可!

原文地址:https://www.cnblogs.com/kivi/p/3195327.html