<html>
<head>
<title>日期</title>
</head>
<body>
<Script Language=JavaScript>
var curDate=new Dat();
dd=curDate.getDate();
mm=curDate.Month()+1;
yy=curDate.getFullyYear();
weekday=curDate.getDay;
xs=curDate.getHours();
document.write(yy);document.write("年");
document.write(mm);document.write("月");
document.write(dd);document.write("日");
var week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
if(weekday==0 || weekday==6){
document.write("<font color='#FF0000'>"+ week[weekday]"+</font>");}
else{
document.write("<font color='#000000'>"+ week[weekday]"+</font>");}
</Script>
我在记事本上和DW都试过了,一字不差的打的,肯定是其他地方出了问题,但我想破脑袋也想不出个所以然,同志们帮帮忙可以吗,谢谢!
基本都是错别字,而且有很多,给你改完的代码是这个,
<html>
<head>
<title>日期</title>
</head>
<body>
<Script Language=JavaScript>
var curDate = new Date();
dd = curDate.getDate();
mm = curDate.getMonth() + 1;
yy = curDate.getFullYear();
weekday = curDate.getDay();
xs = curDate.getHours();
document.write(yy);
document.write("年");
document.write(mm);
document.write("月");
document.write(dd);
document.write("日");
var week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
if( weekday == 0 || weekday == 6) {
document.write("<font color='#FF0000'>" + week[weekday] +"</font>");
}
else {
document.write("<font color='#000000'>" + week[weekday] +"</font>");
}
</Script>
</body>
</html>
发代码出来啊,难道让我们也照着打一遍?
运行报错了吗? 报错截图发出来? 代码贴出来我直接调试 。