JavaScript编写的时间程序执行不了
下面这个程序怎么就是执行不了啊?<SCRIPTlanguage=JavaScripttype=text/JavaScript>varday="";varmonth="";...
下面这个程序怎么就是执行不了啊?
<SCRIPT language=JavaScript type=text/JavaScript>
var day=" ";
var month=" ";
var ampm=" ";
var ampmhour=" ";
var myweekday=" ";
var year=" ";
mydate=new Date();
myweekday=mydate.getDay();
mymonth=mydate.getMonth()+1;
myday=mydate.getDate();
myyear=mydate.getYear();
year=(myyear>200)?myyear:1900+myyear;
if(myweekday==0)
weekday="星期日";
else if(myweekday==1)
weekday="星期一";
else if(myweekday==2)
weekday="星期二";
else if(myweekday==3)
weekday="星期三";
else if(myweekday==4)
weekday="星期四";
else if(myweekday==5)
weekday="星期五";
else if(myweekday==6)
weekday="星期六";
document.write(year+"年"+mymonth+"月"+myday+"日"+weekday);
</script> 展开
<SCRIPT language=JavaScript type=text/JavaScript>
var day=" ";
var month=" ";
var ampm=" ";
var ampmhour=" ";
var myweekday=" ";
var year=" ";
mydate=new Date();
myweekday=mydate.getDay();
mymonth=mydate.getMonth()+1;
myday=mydate.getDate();
myyear=mydate.getYear();
year=(myyear>200)?myyear:1900+myyear;
if(myweekday==0)
weekday="星期日";
else if(myweekday==1)
weekday="星期一";
else if(myweekday==2)
weekday="星期二";
else if(myweekday==3)
weekday="星期三";
else if(myweekday==4)
weekday="星期四";
else if(myweekday==5)
weekday="星期五";
else if(myweekday==6)
weekday="星期六";
document.write(year+"年"+mymonth+"月"+myday+"日"+weekday);
</script> 展开
4个回答
展开全部
把这句话加到你的<head></head>中!
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我的电脑就可以执行啊,你用的是中文版吗?不过跟IE也有关系。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
mymonth,myday,myyear都没有声明,所以不能直接赋值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询