在function前加上<script language="javascript">  最后加上</script>

解决方案 »

  1.   

    <%@ page contentType="text/html; charset=" language="java" import="java.sql.*" errorPage="" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head>
    <script>
    function PageDate()
    {
    currentDate = new Date();
    with (currentDate)
              {
    day=getDay();
    month=getMonth()+1;
    this.document.classname="sj";
    this.document.write('北京时间 '+getFullYear()+'年'+month+'月'+getDate()+'日'+getHours()+'时');
    }
    if (day==1){document.write(' 星期一')};
    if (day==2){document.write(' 星期二')};
    if (day==3){document.write(' 星期三')};
    if (day==4){document.write(' 星期四')};
    if (day==5){document.write(' 星期五')};
    if (day==6){document.write(' 星期六')};
    if (day==0){document.write(' 星期日')};
    document.write('<br>');
    }
    </script>
    <body onLoad="PageDate()">
    </body>
    </html>