-2

我想为我的网站创建一个计数器,这是我的鳕鱼,现在每 1000 毫秒它增加 1 个单位,但我希望每 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> 
4

1 回答 1

0

尝试

function incrementer1() {
    sum += todaycostsec;
    document.time.heure1.value=sum;
}
于 2013-06-24T07:26:36.700 回答