改成
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

解决方案 »

  1.   

    进行了xhtml文档声明后,原来body中的某些属性就会分配给html的document.documentElement,例如这样。<!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"  onscroll="moves()"> 
    <head> 
    <meta   http-equiv="Content-Type"   content="text/html;   charset=utf-8"   /> 
    <title> onscroll </title> 
    <script   type="text/javascript">
    function   moves() {
    var peixun=document.getElementById("peixun")
    peixun.style.top=document.documentElement.scrollTop + 50 + "px";
    peixun.style.left=document.documentElement.scrollLeft + "px";
    }
    </script> 
    </head> 
    <body  onselectstart="return   false"> 
    <textarea   rows="500"   cols="500"   id="textarea1"   name="textarea1"> 
    将文本框设置足够大   就会出现滚动条   这是不动的文字 
    </textarea> 
    <a   id='peixun'   href="http://www.peixun.com"   style="position:absolute;   left:0;   top:50px;"> 跟踪文字 </a>
    </body> 
    </html>