这样???
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="zh-CN" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<meta http-equiv="imagetoolbar" content="no" />
<title>TEST</title>
<style type="text/css"><!--
a, a:link{text-decoration: none; color:#000000; font-size:9pt;}
a:visited{text-decoration: none; color:#000000;}
a:hover{text-decoration: underline; color:red;}
body, td, p, li, div, select{font-size:9pt; font-family:"宋体";}
--></style>
<script type="text/JavaScript">
var DR={};
var MaxHeight,WinHeight;
window.onload=function(){MaxHeight=document.body.scrollHeight;WinHeight=document.body.offsetHeight;}
document.onmousedown=function(e)
{
e = e||event;
var tag=e.srcElement?e.srcElement:e.target;
if(tag.id != 'T1') return;
var o=document.getElementById("T1");
var c=document.getElementById("T2");
DR.c=c;
DR.o= o;
DR.x= e.clientX - o.offsetLeft;
DR.y= e.clientY - o.offsetTop;
DR.w= o.offsetWidth;
DR.h= o.offsetHeight;
DR.c.style.width=DR.w+"px";
DR.c.style.height=DR.h+"px";
if(DR.c.setCapture)DR.c.setCapture();
}
document.onmousemove=function(e)
{
e=e||event;
if(DR.o!=null)
{
var toY=(e.clientY-DR.y);
if(!DR.SI)
{
if((WinHeight+document.body.scrollTop<MaxHeight)&&(toY+DR.w>=WinHeight||document.body.scrollTop>0))
DR.SI=setInterval("scrollWin()",100);
else
{
var toX=(e.clientX-DR.x);
DR.c.style.display='block';
DR.c.style.top= toY+"px";
DR.c.style.left= toX+"px";
}
}
else//在滚动
{
DR.c.style.left=e.clientX-DR.x+"px";
DR.c.style.top=(e.clientY-DR.y)+document.body.scrollTop+"px";
}
}
}
function scrollWin()
{
if(DR.c)
{
var top=parseFloat(DR.c.style.top)+10;
if(top+DR.h<=MaxHeight)
{
DR.c.style.top=top+"px";
window.scrollBy(0,10);
}
else if(DR.SI)
clearInterval(DR.SI);
}
}
document.onmouseup=function()
{
if(DR.o!=null)
{ DR.c.style.display='none';
DR.o.style.left= DR.c.style.left;
DR.o.style.top= DR.c.style.top;
if(DR.SI)
{
clearInterval(DR.SI);
DR.SI=null;
}
if(DR.c.releaseCapture)DR.c.releaseCapture();
DR={};
}
}</script>
</head>
<body onselectstart="return false;">
<div>PAGE START</div>
<p style="color:#FF0000;">目地:一次性拖动DIV到浏览器底部PAGE END处<br></p>
<p style="color:#339900;">在DIV上按下鼠标拖曳层到浏览器底部时浏览器滚动条自动向下走,当然这时鼠标上的层也要跟着向下走<br></p>
<div id="T1" style="position:absolute;zIndex:100;left:300px;top:200px;width:100px;height:100px;background:#FFFF99;border:1px red solid;cursor:move;"> TEST 1</div>
<div id="T2" style="display:none;position:absolute;zIndex:101;background:#99FFCC;border:1px #339900 solid;cursor:move;filter:alpha(opacity=60);"></div>
<div style="height:1200px;"></div>
<div style="margin:50px;">PAGE END</div>
</body>
</html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="zh-CN" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<meta http-equiv="imagetoolbar" content="no" />
<title>TEST</title>
<style type="text/css"><!--
a, a:link{text-decoration: none; color:#000000; font-size:9pt;}
a:visited{text-decoration: none; color:#000000;}
a:hover{text-decoration: underline; color:red;}
body, td, p, li, div, select{font-size:9pt; font-family:"宋体";}
--></style>
<script type="text/JavaScript">
var DR={};
var MaxHeight,WinHeight;
window.onload=function(){MaxHeight=document.body.scrollHeight;WinHeight=document.body.offsetHeight;}
document.onmousedown=function(e)
{
e = e||event;
var tag=e.srcElement?e.srcElement:e.target;
if(tag.id != 'T1') return;
var o=document.getElementById("T1");
var c=document.getElementById("T2");
DR.c=c;
DR.o= o;
DR.x= e.clientX - o.offsetLeft;
DR.y= e.clientY - o.offsetTop;
DR.w= o.offsetWidth;
DR.h= o.offsetHeight;
DR.c.style.width=DR.w+"px";
DR.c.style.height=DR.h+"px";
if(DR.c.setCapture)DR.c.setCapture();
}
document.onmousemove=function(e)
{
e=e||event;
if(DR.o!=null)
{
var toY=(e.clientY-DR.y);
if(!DR.SI)
{
if((WinHeight+document.body.scrollTop<MaxHeight)&&(toY+DR.w>=WinHeight||document.body.scrollTop>0))
DR.SI=setInterval("scrollWin()",100);
else
{
var toX=(e.clientX-DR.x);
DR.c.style.display='block';
DR.c.style.top= toY+"px";
DR.c.style.left= toX+"px";
}
}
else//在滚动
{
DR.c.style.left=e.clientX-DR.x+"px";
DR.c.style.top=(e.clientY-DR.y)+document.body.scrollTop+"px";
}
}
}
function scrollWin()
{
if(DR.c)
{
var top=parseFloat(DR.c.style.top)+10;
if(top+DR.h<=MaxHeight)
{
DR.c.style.top=top+"px";
window.scrollBy(0,10);
}
else if(DR.SI)
clearInterval(DR.SI);
}
}
document.onmouseup=function()
{
if(DR.o!=null)
{ DR.c.style.display='none';
DR.o.style.left= DR.c.style.left;
DR.o.style.top= DR.c.style.top;
if(DR.SI)
{
clearInterval(DR.SI);
DR.SI=null;
}
if(DR.c.releaseCapture)DR.c.releaseCapture();
DR={};
}
}</script>
</head>
<body onselectstart="return false;">
<div>PAGE START</div>
<p style="color:#FF0000;">目地:一次性拖动DIV到浏览器底部PAGE END处<br></p>
<p style="color:#339900;">在DIV上按下鼠标拖曳层到浏览器底部时浏览器滚动条自动向下走,当然这时鼠标上的层也要跟着向下走<br></p>
<div id="T1" style="position:absolute;zIndex:100;left:300px;top:200px;width:100px;height:100px;background:#FFFF99;border:1px red solid;cursor:move;"> TEST 1</div>
<div id="T2" style="display:none;position:absolute;zIndex:101;background:#99FFCC;border:1px #339900 solid;cursor:move;filter:alpha(opacity=60);"></div>
<div style="height:1200px;"></div>
<div style="margin:50px;">PAGE END</div>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货