<!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>
    <title></title>
    <script type="text/javascript">
        function ShowHeader() {
              var txt = document.getElementById("header").innerHTML;
              var subLen = 0;
              var iniTime = 100;
              Show();
              function Show() {
                  var len = txt.length;
                  document.getElementById("header").innerHTML = txt.substring(0, subLen);
                  subLen++;
                  if (subLen > len) {
                      subLen = 1;
                      document.getElementById("header").innerHTML ='';
                      window.setTimeout("Show()", 100);
                  }
                  else {
                      window.setTimeout("Show()", 100);  
                  }
              }
              
            }
    </script>
</head>
<body onload="ShowHeader()">
    <form action="">
        <label id="header">欢迎注册我们的网站</label>
    </form>
</body>
</html>

解决方案 »

  1.   

    <!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>
      <title></title>
      <script type="text/javascript">
      function ShowHeader() {
      var txt = document.getElementById("header").innerHTML;
      var subLen = 0;
      var iniTime = 100;
      
      function Show() {
      var len = txt.length;
      document.getElementById("header").innerHTML = txt.substring(0, subLen);
      subLen++;
      if (subLen > len) {
    subLen = 1;
    document.getElementById("header").innerHTML ='';
    window.setTimeout(function(){Show()}, 100);  
      }
      else {
    window.setTimeout(function(){Show()}, 100);  
      }
    }
    Show()
       
      }
      </script>
    </head>
    <body onload="ShowHeader()">
      <form action="">
      <label id="header">欢迎注册我们的网站</label>
      </form>
    </body>
    </html>