js/javascript每隔一段時間局部刷新部分代碼

更多技術問題解決案例請訪問:IT擺渡網 -- 一個IT實時在線問答平臺,解決任何IT技術難題,無需等待,立馬解決!--www.itbaiduwang.com




<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/jquery-1.5.1.js"></script>
<style type="text/css">

button.b1{background-color: #39b3d7;}

button.b2{background-color: red;}

</style>
<script>

$(function(){    
    $("#sxa").click(function(){
        
        $("#cs").load('/ceshi2.php');        
    });    
});

function funcTest(){

    //每隔3秒執行一次timelyFun方法

    window.setInterval("timelyFun()",1000);

}

function timelyFun()
{
    $("#cs").load('/ceshi2.php');    
}

window.onload = funcTest();


        
    </script>

</head>
<body>

<div class="container">
<span>A刷新次數:</span>
<div id="cs"><?php include("ceshi2.php");?></div>
</div>
<button id="sxa">點擊刷新A</button>
<div class="container1">
<span>B刷新次數:</span>
<div id="cs1"><?php include("ceshi1.php");?></div>
</div>
<button id="sxb">點擊刷新B</button>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章