这是错的,你说哪里错了
<html>
<head>
</head>
<body>
<script language="JavaScript">
<!--
todayDate()= new Date();
date= todayDate.getDate();
month= todayDate.getMonth() +1;
year= todayDate.getYear();
document.write("今天是");
document.write("<br>");
if(navigator.appName== "Netscape")
{
document.write(1900+year);
document.write("年");
document.write(month);
document.write("月");
document.write(date);
document.write("日");
document.write("</br>");}
if(navigator.appVersion.indexOf("MSIE")!= -1)
{
document.write(year);
document.write("年");
document.write(month);
document.write("月");
document.write(date);
document.write("日");
document.write("</br>");
}
if(todayDate.getDay()==1)
document.write("星期一");
if(todayDate.getDay()==2)
document.write("星期二");
if(todayDate.getDay()==3)
document.write("星期三");
if(todayDate.getDay()==4)
document.write("星期四");
if(todayDate.getDay()==5)
document.write("星期五");
if(todayDate.getDay()==6)
document.write("星期六");
if(todayDate.getDay()==0)
document.write("星期日");
//--> 
</script>
</body>
</html>
这是书上的,你看看哪里不同了

解决方案 »

  1.   

    这是书上的
    <html>
    <head>
    </head>
    <body>
    <script language="JavaScript">
    <!--
    todayDate = new Date();
    date = todayDate.getDate();
    month= todayDate.getMonth() +1;
    year= todayDate.getYear();
    document.write("今天是")
    document.write("<br>")
    if(navigator.appName == "Netscape")
    {
    document.write(1900+year);
    document.write("年");
    document.write(month);
    document.write("月");
    document.write(date);
    document.write("日");
    document.write("<br>")
    }
    if(navigator.appVersion.indexOf("MSIE") != -1)
    {
    document.write(year);
    document.write("年");
    document.write(month);
    document.write("月");
    document.write(date);
    document.write("日");
    document.write("<br>")
    }
    if (todayDate.getDay() == 5) document.write("星期五")
    if (todayDate.getDay() == 6) document.write("星期六")
    if (todayDate.getDay() == 0) document.write("星期日")
    if (todayDate.getDay() == 1) document.write("星期一")
    if (todayDate.getDay() == 2) document.write("星期二")
    if (todayDate.getDay() == 3) document.write("星期三")
    if (todayDate.getDay() == 4) document.write("星期四")//--> 
    </script>
    </body>
    </html>
      

  2.   

    换行写:
    if (todayDate.getDay() == 5)
    document.write("星期五");
    if (todayDate.getDay() == 6)
    document.write("星期六");
    if (todayDate.getDay() == 0)
    document.write("星期日");
    if (todayDate.getDay() == 1)
    document.write("星期一");
    if (todayDate.getDay() == 2)
    document.write("星期二");
    if (todayDate.getDay() == 3)
    document.write("星期三");
    if (todayDate.getDay() == 4)
    document.write("星期四");
      

  3.   

    你的:todayDate()= new Date();
    书上的:todayDate = new Date();
      

  4.   

    已经出来了
    第一:todayDate()= new Date();
    你多加了():todayDate()
    第二:if(navigator.appVersion.indexOf("MSIE")!= -1)
    这里的括号不对,应该是:
    if(navigator.appVersion.indexOf("MSIE")!= -1)你自己改下你的。就这2个。我已经运行过了。如果对了。你就速度结贴给分。
      

  5.   

    楼上说的很对,第二点就是你的括号不是在英文状态下输入的,导致括号不正确
    就像在SQL语句里面的一个空格和逗号是一样的,都是不正确不能运行的
      

  6.   

    <html>
    <head>
    </head>
    <body>
    <script language="JavaScript">
    <!--
    todayDate= new Date();date= todayDate.getDate();
    month= todayDate.getMonth() +1;
    year= todayDate.getYear();
    document.write("今天是");
    document.write("<br>");
    if(navigator.appName== "Netscape")
    {
    document.write(1900+year);
    document.write("年");
    document.write(month);
    document.write("月");
    document.write(date);
    document.write("日");
    document.write("</br>");}
    if(navigator.appVersion.indexOf("MSIE")!= -1)
    {
    document.write(year);
    document.write("年");
    document.write(month);
    document.write("月");
    document.write(date);
    document.write("日");
    document.write("</br>");
    }
    if(todayDate.getDay()==1)
    document.write("星期一");
    if(todayDate.getDay()==2)
    document.write("星期二");
    if(todayDate.getDay()==3)
    document.write("星期三");
    if(todayDate.getDay()==4)
    document.write("星期四");
    if(todayDate.getDay()==5)
    document.write("星期五");
    if(todayDate.getDay()==6)
    document.write("星期六");
    if(todayDate.getDay()==0)
    document.write("星期日");
    //-->  
    </script>
    </body>
    </html>
     看红色部分就知道了