日期:2014-05-18  浏览次数:20505 次

.NET中遇到了js一个小问题,请各位大仙指点迷经。谢谢
各位大神!今天遇到一个问题,不知道那里出了问题(就是有js编写只含时分秒的简单秒表,但是秒只能到08就又从00开始了?搞不通为什么?那位大神给解释一下,详细点。在线等!!!!谢谢)一下为程序代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>无标题页</title>
  <script type="text/javascript" language="javascript">
  var time = new String;
  function TimeOpen() {
  var miunte = document.form1.txt2.value;
  var hour = document.form1.txt1.value;
  var t = new Date;
  var seconds =parseInt(document.form1.txt3.value)+1;
  if (seconds < 10)
  seconds = "0"+seconds;
  document.form1.txt3.value = seconds;
  if (document.form1.txt3.value == 00) 
  {
  miunte = parseFloat(miunte) + 1;
  if (document.form1.txt2.value >= 60) 
  {
  hour = parseFloat(hour) + 1;
  if (hour < 0) 
  {
  hour = "0" + hour;
  }
  else if (hour >= 24) 
  {
  hour = parseFloat(hour) - 24;
  }
  document.form1.txt1.value = hour;  
  }
  if (miunte < 10) 
  {
  miunte = "0" + miunte;
  }
  else if (miunte > 60) 
  {
  miunte = parseFloat(miunte) - 60;
  }
  document.form1.txt2.value = miunte;
  }
   
  time = setTimeout("TimeOpen()",1000);
  }
  function TimeStep() {
  time = clearTimeout(time);
  }

  </script>
  <style type="text/css">
  #Button1
  {
  width: 62px;
  }
  #Button2
  {
  width: 62px;
  }
  .type1
  {
  text-align:right;
  }
  </style>
</head>
<body>
<center>
<form name="form1">
  <table style="width:68%;">
  <tr align="center">
  <td>
  <input class="type1" id="Text1" type="text" name="txt1" value="00" />时</td>
  <td>
  <input class="type1" id="Text2" type="text" name="txt2" value="00" />分</td>
  <td>
  <input class="type1" id="Text3" type="text" name="txt3" value="00"/>秒</td>
  </tr>
  <tr align="center">
  <td>
  <input id="Button1" type="button" value="开始" onclick="TimeOpen()"/></td