<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>这样看起来下拉的地方就没有了</title>
</head>
<script type="text/javascript">
<!--
var Then = new Date();
Then.setTime(Then.getTime() + 1 ); //秒分
var cookieString = new String(document.cookie);
var cookieHeader = "POPWIN" ;
var beginPosition = cookieString.indexOf(cookieHeader);
if (beginPosition == -1)
{
var newtop=0
var newleft=0
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
else
{
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}
var autoclick_ok=false;
function toExit(){
autoclick_ok=true;
document.cookie = "Cookie9=POPWIN;expires="+ Then.toGMTString() +";path=/";
}
function doMouseMove() {
layerName = 'iit'
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
if(!autoclick_ok)
{
eval('curElement'+styleSwitch+'.visibility="visible"')
}else{
eval('curElement'+styleSwitch+'.visibility="hidden"')
}
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 10 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 10 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX-10
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')
if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY-10
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}
document.onmousemove = doMouseMove;
if (navigator.appName == "Netscape") {
}
else
{
document.write('<div ID=OuterDiv>')
document.write('<a href="http://www.baidu.com/" target="_blank"><img border="0" ID=iit src="1.gif"  STYLE="position:absolute;TOP:0pt;LEFT:0pt;width=15;height=13;Z-INDEX:99999999999;visibility:hidden;" onclick="toExit()"></a>')
document.write('</div>')
}
}
-->
</script><body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>这里当拖动滚动条的时候,透明图片就向上跑了,</p>
<p>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;</p>
<p>把这句更换成</p>
<p>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;<br />
&lt;html&gt;</p>
<p>这样就正常了,有什么办法全兼容吗?或者兼容第一个!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</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">把这句更换成<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>这样就正常了,有什么办法全兼容吗?或者兼容第一个
      

  2.   

    document.body.scrollTop 改成 document.documentElement.scrollTop
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>这样看起来下拉的地方就没有了</title>
    </head>
    <script type = "text/javascript" > 
    <!--
    var Then = new Date();
    Then.setTime(Then.getTime() + 1); //秒分
    var cookieString = new String(document.cookie);
    var cookieHeader = "POPWIN";
    var beginPosition = cookieString.indexOf(cookieHeader);
    if (beginPosition == -1) {
        var newtop = 0
        var newleft = 0
        if (navigator.appName == "Netscape") {
            layerStyleRef = "layer.";
            layerRef = "document.layers";
            styleSwitch = "";
        } else {
            layerStyleRef = "layer.style.";
            layerRef = "document.all";
            styleSwitch = ".style";
        }
        var autoclick_ok = false;
        function toExit() {
            autoclick_ok = true;
            document.cookie = "Cookie9=POPWIN;expires=" + Then.toGMTString() + ";path=/";
        }
        function doMouseMove() {
            layerName = 'iit'
            eval('var curElement=' + layerRef + '["' + layerName + '"]')
            eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility="hidden"')
            if (!autoclick_ok) {
                eval('curElement' + styleSwitch + '.visibility="visible"')
            } else {
                eval('curElement' + styleSwitch + '.visibility="hidden"')
            }
            eval('newleft=document.body.clientWidth-curElement' + styleSwitch + '.pixelWidth')
            eval('newtop=document.body.clientHeight-curElement' + styleSwitch + '.pixelHeight')
            eval('height=curElement' + styleSwitch + '.height')
            eval('width=curElement' + styleSwitch + '.width')
            width = parseInt(width)
            height = parseInt(height)
            if (event.clientX > (document.body.clientWidth - 10 - width)) {
                newleft = document.body.clientWidth + document.body.scrollLeft - 10 - width
            } else {
                newleft = document.documentElement.scrollLeft + event.clientX - 10
            }
            eval('curElement' + styleSwitch + '.pixelLeft=newleft')
            if (event.clientY > (document.body.clientHeight - 5 - height)) {
                newtop = document.body.clientHeight + document.body.scrollTop - 5 - height
            } else {
                newtop = document.documentElement.scrollTop + event.clientY - 10
            }
            eval('curElement' + styleSwitch + '.pixelTop=newtop')
        }
        document.onmousemove = doMouseMove;
        if (navigator.appName == "Netscape") {} else {
            document.write('<div ID=OuterDiv>')
            document.write('<a href="http://www.baidu.com/" target="_blank"><img border="0" ID=iit src="1.gif"  STYLE="position:absolute;TOP:0pt;LEFT:0pt;width=15;height=13;Z-INDEX:99999999999;visibility:hidden;" onclick="toExit()"></a>')
            document.write('</div>')
        }
    }
    -->
    </script>
    <body>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>这里当拖动滚动条的时候,透明图片就向上跑了,</p>
    <p>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />
      &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;</p>
    <p>把这句更换成</p>
    <p>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;<br />
      &lt;html&gt;</p>
    <p>这样就正常了,有什么办法全兼容吗?或者兼容第一个!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </body>
    </html>
      

  3.   

    test:
    所有
    document.body.XXX
    换为
    document.documentElement.XXX
      

  4.   

    简化一下^_^<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>跟随鼠标的图片_DTD</title>
    </head>
    <body><script type="text/javascript">
    <!--
    var autoclick_ok=false;
    function toExit(){
    autoclick_ok=true;
    }var layerName = 'iit'
    function doMouseMove() {
    var curElement=document.getElementById(layerName)
    curElement.style.visibility=(!autoclick_ok)?"visible":"hidden" var newleft=document.documentElement.clientWidth-curElement.style.pixelWidth
    var newtop=document.documentElement.clientHeight-curElement.style.pixelHeight
    var height=parseInt(curElement.style.height)
    var width=parseInt(curElement.style.width) if (event.clientX > (document.documentElement.clientWidth - 10 - width))
    newleft=document.documentElement.clientWidth + document.documentElement.scrollLeft - 10 - width
    else
    newleft=document.documentElement.scrollLeft + event.clientX-10
    curElement.style.pixelLeft=newleft if (event.clientY > (document.documentElement.clientHeight - 5 - height))
    newtop=document.documentElement.clientHeight + document.documentElement.scrollTop - 5 - height
    else
    newtop=document.documentElement.scrollTop + event.clientY-10
    curElement.style.pixelTop=newtop
    }
    document.write('<div ID=OuterDiv>')
    document.write('<a href="http://www.baidu.com/" target="_blank"><img border="0" ID=iit src="1.gif"  STYLE="position:absolute;TOP:0pt;LEFT:0pt;width=15;height=13;Z-INDEX:99999999999;visibility:hidden;" onclick="toExit()"></a>')
    document.write('</div>')
    document.onmousemove = doMouseMove;
    -->
    </script><div style="height:999px;"></div>
    </body>
    </html>