JS代码为什么不显示输出结果!!求大神解释!

a197643495 2017-12-30 11:41:52
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
<style>
.word_white {
font-size: 9pt;
color: #FFFFFF;
}
</style>

<script type="text/javascript">
window.onload=function(){
function clockon(bgclock){
var now=new Date();
var year=now.getYear();
var month=now.getMonth();
var date=now.getDate();
var day=now.getDay();
var hour=now.getHours();
var minu=now.getMinutes();
var sec=now.getSeconds();
var week;
month=month+1;
if(month<10) month="0"+month;
if(date<10) date="0"+date;
if(hour<10) hour="0"+hour;
if(minu<10) minu="0"+minu;
if(sec<10) sec="0"+sec;
var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
week=arr_week[day];
var time="";
time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec;
if(document.all){
bgclock.innerHTML="<b>"+time+"</b>"
}
var timer=setTimeout("clockon(bgclock)",200);
}
}
</script>
</head>
<body>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr bgcolor="#DFA40C">
<td width="3%" height="27"> </td>
<td width="29%"><div id="bgclock" class="word_white"></div></td>
</tr>
</table>
</body>
</html>
...全文
336 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
天际的海浪 2017-12-30
  • 打赏
  • 举报
回复

<!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" xml:lang="en">
	<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title></title>
		<style>
			.word_white {
			font-size: 9pt;
			color: #FFFFFF;
		}
		</style>
		
<script type="text/javascript">
	window.onload=function(){
		function clockon(bgclock){
			var now=new Date();
			var year=now.getYear();
			var month=now.getMonth();
			var date=now.getDate();
			var day=now.getDay();
			var hour=now.getHours();
			var minu=now.getMinutes();
			var sec=now.getSeconds();
			var week;
			month=month+1;
			if(month<10) month="0"+month;
			if(date<10) date="0"+date;
			if(hour<10) hour="0"+hour;
			if(minu<10) minu="0"+minu;
			if(sec<10) sec="0"+sec;
			var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
			week=arr_week[day];
			var time="";
			time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec;
			bgclock.innerHTML="<b>"+time+"</b>"
		} 
		var dom = document.getElementById("bgclock");
		var timer = setInterval(function(){
			clockon(dom);
		}, 200);
	}
</script>
	</head>
	<body>
		<table width="778"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
		    <tr bgcolor="#DFA40C">
		      <td width="3%" height="27"> </td>
		      <td width="29%"><div id="bgclock" class="word_white"></div></td>
		    </tr>
		</table>
	</body>
</html>

87,937

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧