87,923
社区成员
发帖
与我相关
我的任务
分享
<html>
<script>
var h=setInterval("showTime()", 1000);
function showTime()
{
var today = new Date();
document.getElementById("test").innerHTML = "The time is: " + today.toString();
}
</script>
<body>
<span id="test" ></span><a style="display:none" href="http://silverlight.net/showcase/">silverlight</a>
<input type="button" value="stop" onclick="clearInterval(h);"/>
<input type="button" value="start" onclick="setInterval('h=showTime()',1000);"/>
</body>
</html>
<html>
<script>
var h=null;
function showTime()
{
var today = new Date();
document.getElementById("test").innerHTML = "The time is: " + today.toString();
}
</script>
<body>
<span id="test" ></span><a style="display:none" href="http://silverlight.net/showcase/">silverlight</a>
<input type="button" value="stop" onclick="if(h===null)return;clearInterval(h);h=null"/>
<input type="button" value="start" onclick="if(h!=null)return;h=setInterval('showTime()',1000);"/>
</body>
</html>
<input type="button" value="start" onclick="h=setInterval('showTime()',1000);"/>