我想为我的网站创建一个计数器,这是我的鳕鱼,现在evry 1000毫秒它增加1个单位但是我希望那个evry 1000毫秒它增加今天costsec ???
<html>
<script language="javascript">
sumcost=4000;
todaycost=500;
todaycostsec=(500)/86400;
var sum;
var Min;
Min=(sumcost-todaycost);
function incrementer() {
sum=(Min+todaycostsec);
document.time.heure.value=sum;
//document.time.result.value=sum;
}
function incrementer1() {
sum++;
//sum= Math.ceil(Min + ( todaycost* todaycostsec));
document.time.heure1.value=sum;
}
interv = setInterval("incrementer1()",1000);
</script>
<form name="time">
<input type="text" value="" name="heure" onclick="incrementer();"/>
<input type="text" value="" name="heure1" onclick="incrementer1();"/>
<div align="center">
<script language="JavaScript">
//document.write('<input style="FONT-WEIGHT: bold; bo ?rder: none; color:#CC0000 ; FONT-SIZE: 14pt; TEXT-ALIGN: center;" name=result size=30 value="incrementer()">');
</script>
</div>
</form>
</html>
答案 0 :(得分:0)
尝试
function incrementer1() {
sum += todaycostsec;
document.time.heure1.value=sum;
}