Clock.innerHTML=innerString;Clock.innerHTML=timeString;

解决方案 »

  1.   

    代码发错了!
    下面这个才是<html>
      <head>
        <title>网页时钟2</title>
        <script language="javascript">
          function tick()
          {
            var hours,minutes,seconds,xfile;
            var intHours,intMinutes,intSeconds;
            var today;
            today=new Date();
            intHours=today.getHours();
            intMinutes=today.getMinutes();
            int Seconds=today.getSeconds();
            if(intHours==0)
            {
              hours="12:";
              xfile="现在是午夜,该休息了";
            }
            else if(intHours<12)
            {
              hours=intHours+":";
              xfile="现在是上午,新的一天开始了";
            }
            else if(intHours==12)
            {
              hours="12:";
              xfile="现在是正午,该吃饭了";
            }
            else
            {
              intHours-=12;
              hours=intHours+":";
              xfile="现在是下午,抓紧时间吧";
            }
            if(intMinutes<10)
            {
              minutes="0"+intMinutes+":"; 
            }
            else
            {
              minutes=intMinutes+":";
            }
            if(intSeconds<10)
            {
              seconds="0"+intSeconds;
            }
            else
            {
              seconds=intSeconds;
            }
            timeString=xfile+hours+minutes+seconds;
            Clock.innerHTML=timeString;
            window.setTimeout("tick();",100);
          }
          window.onload=tick;
        </script>
      </head>
      <body>
        <div id="Clock" align="center" style="font-size:20;color:#000000"></div>
      </body>
    </html>
      

  2.   

    timeString=hours+minutes+seconds+ap; 
    Clock.innerHTML=innerString; 看到没?
    红色部分
    不一样,怎么显示
    innerString你这个都还没定义
      

  3.   

    <!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">
    <head> 
    <script language="JavaScript"> 
    <!-- 
    function tick() { 
    var hours,minutes,seconds,ap; 
    var intHours,intMinutes,intSeconds; 
    var today; 
    var timeString;
    today=new Date(); intHours=today.getHours(); 
    intMinutes=today.getMinutes(); 
    intSeconds=today.getSeconds(); 
    if (intHours==0) { 
    hours="12" ; 
    ap="Midnight"; 

    else if (intHours<12) { 
    hours=intHours+":" ; 
    ap="A.M."; 

    else if(intHours==12) { 
    hours="12" ; 
    ap="Noon"; 

    else { 
    intHours=intHours-12 
    hours=intHours+":"; 
    ap="P.M."; 
    } if (intMinutes<10) { 
    minutes="0"+intMinutes+":"; 
    } else{ 
    minutes=intMinutes+":"; 

    if(intSeconds < 10) { 
    seconds="0"+intSeconds+":" 
    } else { 
    seconds=intSeconds+""; 

    timeString=hours+minutes+seconds+ap; 
    Clock.innerHTML=timeString; 
    window.setTimeout("tick();",100); 

    window.onload =tick; --> 
    </script> </head> 
    <body> 
    <h1>改变页面样式</h1> 
    <div id="Clock" align= center></div> 
    <table border==1> 
    <tr> 
    <td>时钟颜色</td> 
    <td>时钟背景</td> 
    <td>时钟字体</td> 
    <td>时钟尺寸</td> 
    <td>时钟粗细</td> 
    </tr> 
    <tr> 
    <td colspan="5"></td> 
    </tr> 
    <tr> 
    <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.color='purple'">紫色</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.background='red'">红色</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.fontFamily='verdana'">无边试</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.fontSize='24pt'">24pt</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.fontWeight='normal'">普通</span> 
    </td> 
    </tr> <tr> 
    <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.color='white'">白色</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.background='yellow'">黄色</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.fontFamily='Georgia'">有边试</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.fontSize='36pt'">36pt</span> 
    </td> <td><span onmouseover="this.style.cursor='hand'" 
    onmouseout="this.style.cursor='default'" 
    onClick="Clock.style.fontWeight='bold'">组体</span> 
    </td> 
    </tr> </table> 
    </body> 
    </html>
      

  4.   

    代码发错了!
    下面这个才是<html>
      <head>
        <title>网页时钟2</title>
        <script language="javascript">
          function tick()
          {
            var hours,minutes,seconds,xfile;
            var intHours,intMinutes,intSeconds;
            var today;
            today=new Date();
            intHours=today.getHours();
            intMinutes=today.getMinutes();
            int Seconds=today.getSeconds();
            if(intHours==0)
            {
              hours="12:";
              xfile="现在是午夜,该休息了";
            }
            else if(intHours<12)
            {
              hours=intHours+":";
              xfile="现在是上午,新的一天开始了";
            }
            else if(intHours==12)
            {
              hours="12:";
              xfile="现在是正午,该吃饭了";
            }
            else
            {
              intHours-=12;
              hours=intHours+":";
              xfile="现在是下午,抓紧时间吧";
            }
            if(intMinutes<10)
            {
              minutes="0"+intMinutes+":"; 
            }
            else
            {
              minutes=intMinutes+":";
            }
            if(intSeconds<10)
            {
              seconds="0"+intSeconds;
            }
            else
            {
              seconds=intSeconds;
            }
            timeString=xfile+hours+minutes+seconds;
            Clock.innerHTML=timeString;
            window.setTimeout("tick();",100);
          }
          window.onload=tick;
        </script>
      </head>
      <body>
        <div id="Clock" align="center" style="font-size:20;color:#000000"></div>
      </body>
    </html>
      

  5.   

    代码发错了!
    下面这个才是<html>
      <head>
        <title>网页时钟2</title>
        <script language="javascript">
          function tick()
          {
            var hours,minutes,seconds,xfile;
            var intHours,intMinutes,intSeconds;
            var today;
            today=new Date();
            intHours=today.getHours();
            intMinutes=today.getMinutes();
            int Seconds=today.getSeconds();
            if(intHours==0)
            {
              hours="12:";
              xfile="现在是午夜,该休息了";
            }
            else if(intHours<12)
            {
              hours=intHours+":";
              xfile="现在是上午,新的一天开始了";
            }
            else if(intHours==12)
            {
              hours="12:";
              xfile="现在是正午,该吃饭了";
            }
            else
            {
              intHours-=12;
              hours=intHours+":";
              xfile="现在是下午,抓紧时间吧";
            }
            if(intMinutes<10)
            {
              minutes="0"+intMinutes+":"; 
            }
            else
            {
              minutes=intMinutes+":";
            }
            if(intSeconds<10)
            {
              seconds="0"+intSeconds;
            }
            else
            {
              seconds=intSeconds;
            }
            timeString=xfile+hours+minutes+seconds;
            Clock.innerHTML=timeString;
            window.setTimeout("tick();",100);
          }
          window.onload=tick;
        </script>
      </head>
      <body>
        <div id="Clock" align="center" style="font-size:20;color:#000000"></div>
      </body>
    </html>
      

  6.   

    那个ultraedit不知道怎么回事 复制了代码 但只能在ultredit自身里面粘贴 粘贴到网页上就不行了
    我自己的代码是5L发的 实在是看不出什么错误……
    我一直是做C/C++方面的东西 对这种解释执行的dubug真没啥经验……
      

  7.   


    today=new Date();
    intHours=today.getHours();
    intMinutes=today.getMinutes();
    int Seconds=today.getSeconds(); // 你自己马虎了 int Seconds===》intSeconds