<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
var id,im=0,is=1;
start=new Date();
function go()
{
now =new Date();
time=(now.getTime()-start.getTime())/1000;
time=Math.floor(time);
is=time%60;
im=Math.floor(time/60);
if(is<10)
document.myform.clocks.value=" "+im+" 分 0"+is+"秒";
else
document.myform.clocks.value=" "+im+"分"+is+"秒";
id=setTimeout("go()",1000);
}
go();
</script>
</head><body>
<form name="mytable" id="myform">
<input name="tclocks" id="clocks" type="text" value="" />
</body>
</html>
预览时总是弹出提示---------------------------
错误
---------------------------
出现了运行时间错误。
是否要进行调试?行: 16
错误: 'document.myform.clocks' 为空或不是对象
---------------------------
是(Y) 否(N)
---------------------------不知道是哪里出问题了?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
var id,im=0,is=1;
start=new Date();
function go()
{
now =new Date();
time=(now.getTime()-start.getTime())/1000;
time=Math.floor(time);
is=time%60;
im=Math.floor(time/60);
if(is<10)
document.myform.clocks.value=" "+im+" 分 0"+is+"秒";
else
document.myform.clocks.value=" "+im+"分"+is+"秒";
id=setTimeout("go()",1000);
}
go();
</script>
</head><body>
<form name="mytable" id="myform">
<input name="tclocks" id="clocks" type="text" value="" />
</body>
</html>
预览时总是弹出提示---------------------------
错误
---------------------------
出现了运行时间错误。
是否要进行调试?行: 16
错误: 'document.myform.clocks' 为空或不是对象
---------------------------
是(Y) 否(N)
---------------------------不知道是哪里出问题了?
我现在还不太清楚,document访问form时候还有访问form里的控件的时候用的是name属性的值还是id属性的值?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
var id,im=0,is=1;
start=new Date();
function go()
{
now =new Date();
time=(now.getTime()-start.getTime())/1000;
time=Math.floor(time);
is=time%60;
im=Math.floor(time/60);
if(is<10)
document.myform.clocks.value=" "+im+" 分 0"+is+"秒";
else
document.myform.clocks.value=" "+im+"分"+is+"秒";
id=setTimeout("go()",1000);
}
window.onload=function(){
go();
}
</script>
</head><body>
<form name="myform">
<input name="clocks" type="text" value="" />
</form>
</body>
</html>