我怎样才能避免刷新计数器,我尝试了所有的方式。<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Digitl clock</title>
<style type="text/css">
#time{
font-size:50pt;
}
</style>
</head>
<body 枚nload="timer()">
<script type="text/javascript" language="javascript">
//var digiclock = "00:00:00";
i = 0;
function timer()
{
var digiformat = "";
if(i>3599)
{
var H = Math.floor(i/3600);
}
else
{
var H = 0;
}
var M = i - (H*3600)
if(M>59)
{
M = Math.floor(M/60)
}
else
{
M = 0
}
var S = i - (M*60)
if(H<10)
{
H = "0"+H;
}
if(M<10)
{
M = "0"+M;
}
if(S<10)
{
S = "0"+S;
}
// document.getElementById('time').innerHTML = H+":"+M+":"+S;
document.getElementById('lblTimer').innerHTML = H+":"+M+":"+S;
setTimeout('timer()', 1000);
i++;
}
</script>
<%--<asp:HiddenField ID="hidenfld" runat="server" />--%>
<asp:Label ID="lblTimer" runat="server" Font-Size="30px" ></asp:Label>     
<input type=button ID="btnrefresh" runat="server" value="refresh"/>
</body>
</html>