简单的网页时钟问题 document.clock.time.value=timestr; document.clock.date.value=datestr; 把上面语句的clock去掉,你的html里没有clock节点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 timestr+=((minutes<10):"0":"")+minutes;timestr+=((seconds<10):"0":"")+seconds;三目 ":" 改为 "?" <html> <head> <title>网页时钟操作</title> <script language="javascript"> var timestr,datestr; function clock(){ now=new Date(); hours=now.getHours(); minutes=now.getMinutes(); seconds=now.getSeconds(); timestr=""+hours+":";// timestr+=((minutes<10):"0":"")+minutes; timestr+=((minutes<10)?"0":"")+minutes+":";// timestr+=((seconds<10):"0":"")+seconds; timestr+=((seconds<10)?"0":"")+seconds; document.clock.time.value=timestr; date=now.getDate(); month=now.getMonth()+1;// year=now.getYear(); year=now.getFullYear(); datestr=month+"/"; datestr+=((date<10)?"0"+date:date)+"/"; datestr+=year; document.clock.date.value=datestr;// timer=setTimeOut("clock()",1000); timer=setTimeout("clock()",1000); } </script> </head> <body onload=clock()> <!--form--> <form name=clock> 时间: <input type="text" name=time size=10 value=""><br> 日期: <input type="text" name=date size=10 value=""><br> </form> </body></html> <html> <head> <title>网页时钟操作</title> <script language="javascript"> var timestr,datestr; function clock(){ now=new Date(); hours=now.getHours(); minutes=now.getMinutes(); seconds=now.getSeconds(); timestr=""+hours+":";// timestr+=((minutes<10):"0":"")+minutes; timestr+=((minutes<10)?"0":"")+minutes+":";// timestr+=((seconds<10):"0":"")+seconds; timestr+=((seconds<10)?"0":"")+seconds; document.clock.time.value=timestr; date=now.getDate(); month=now.getMonth()+1;// year=now.getYear(); year=now.getFullYear(); datestr=((month<10)?"0"+month:month)+"/"; datestr+=((date<10)?"0"+date:date)+"/"; datestr+=year; document.clock.date.value=datestr;// timer=setTimeOut("clock()",1000); timer=setTimeout("clock()",1000); } </script> </head> <body onload=clock()> <!--form--> <form name=clock> 时间: <input type="text" name=time size=10 value=""><br> 日期: <input type="text" name=date size=10 value=""><br> </form> </body></html> 请教各位大哥,火狐兼容性问题,此幻灯片在ie下显示正常。但火狐下不能显示。 求js中fireEvent的用法 图片显示问题 看了一天的Ext,好像还没入门 javascript 问题,如何实现 为什么说JS中的函数是数据类型 页面返回问题 放焰火,applet源代码 请教各位:如何使用自定义的菜单来屏幕掉IE的右键系统菜单? 请问如何使(10.66 - 10) 等于0.66呀? 请问这段代码总是提示函数未定义 js怎么生成这段 html啊?
timestr+=((seconds<10):"0":"")+seconds;
三目 ":" 改为 "?"
<html>
<head>
<title>网页时钟操作</title>
<script language="javascript">
var timestr,datestr;
function clock(){
now=new Date();
hours=now.getHours();
minutes=now.getMinutes();
seconds=now.getSeconds();
timestr=""+hours+":";
// timestr+=((minutes<10):"0":"")+minutes;
timestr+=((minutes<10)?"0":"")+minutes+":";
// timestr+=((seconds<10):"0":"")+seconds;
timestr+=((seconds<10)?"0":"")+seconds;
document.clock.time.value=timestr;
date=now.getDate();
month=now.getMonth()+1;
// year=now.getYear();
year=now.getFullYear();
datestr=month+"/";
datestr+=((date<10)?"0"+date:date)+"/";
datestr+=year;
document.clock.date.value=datestr;
// timer=setTimeOut("clock()",1000);
timer=setTimeout("clock()",1000);
}
</script>
</head>
<body onload=clock()>
<!--form-->
<form name=clock>
时间:
<input type="text" name=time size=10 value=""><br>
日期:
<input type="text" name=date size=10 value=""><br>
</form>
</body>
</html>
<html>
<head>
<title>网页时钟操作</title>
<script language="javascript">
var timestr,datestr;
function clock(){
now=new Date();
hours=now.getHours();
minutes=now.getMinutes();
seconds=now.getSeconds();
timestr=""+hours+":";
// timestr+=((minutes<10):"0":"")+minutes;
timestr+=((minutes<10)?"0":"")+minutes+":";
// timestr+=((seconds<10):"0":"")+seconds;
timestr+=((seconds<10)?"0":"")+seconds;
document.clock.time.value=timestr;
date=now.getDate();
month=now.getMonth()+1;
// year=now.getYear();
year=now.getFullYear();
datestr=((month<10)?"0"+month:month)+"/";
datestr+=((date<10)?"0"+date:date)+"/";
datestr+=year;
document.clock.date.value=datestr;
// timer=setTimeOut("clock()",1000);
timer=setTimeout("clock()",1000);
}
</script>
</head>
<body onload=clock()>
<!--form-->
<form name=clock>
时间:
<input type="text" name=time size=10 value=""><br>
日期:
<input type="text" name=date size=10 value=""><br>
</form>
</body>
</html>