<script>
var bIsCatchFlyBar = false;
var dragClickX = 0;
var dragClickY = 0;
var displayway = false;
function show(){
alert("window.event.x:"+window.event.x+"\nwindow.event.y:"+window.event.y+"\nevent.clientX:"+event.clientX+"\nevent.clientY:"+event.clientY+"\nevent.offsetX:"+event.offsetX+"\nevent.offsetY:"+event.offsetY+"\nwindow.event.screenX:"+window.event.screenX+"\nwindow.event.screenY:"+window.event.screenY+"\nscrollleft+x:"+document.body.scrollTop+event.x);
}
function catchFlyBar(e){
var obj = getSelectorObj('test');
var objaaa = getSelectorObj('screenFront');
screenChange(objaaa);
objaaa.style.visibility="visible";
bIsCatchFlyBar = true;
var x=event.x+document.body.scrollLeft;
var y=event.y+document.body.scrollTop;
dragClickX=x-obj.offsetLeft;
dragClickY=y-obj.offsetTop;
obj.setCapture();
document.onmousemove = onmousemove1;
document.onmouseup = onmouseup1;
}
function getSelectorObj(name){
var obj;
if (document.layers){
obj = document.layers[name];
}
else if (document.all){
obj = document.all[name];
}
else if (document.getElementById){
obj = document.getElementById(name);
}
return obj;
}
function onmouseup1(){
var obj = getSelectorObj('test');
var objaaa = getSelectorObj('screenFront');
screenChange(objaaa);
objaaa.style.visibility="hidden";
bIsCatchFlyBar = false;
obj.releaseCapture();
}
function onmousemove1(){
if(bIsCatchFlyBar){
var obj = getSelectorObj('test');
obj.style.left = event.x+document.body.scrollLeft-dragClickX;
obj.style.top = event.y+document.body.scrollTop-dragClickY;
}
}
function screenChange(obj)
{
obj.style.left=0;
obj.style.top=0;
obj.style.height=document.body.scrollHeight;
obj.style.width=document.body.scrollWidth;
}
</script>
<div id="screenFront" style="position:absolute;visibility:hidden;width:100%;height:100%;background: #000000;filter:alpha(opacity=50)"></div><div id="test" style="position:absolute;left:100;top:100">
<table border=1 cellpadding=15 cellspacing=15 >
<tr><td>
<table><tr style="cursor:move" nowrap onMouseDown="catchFlyBar()"><td>Click here to show. </td></tr></table>
</div>
</td></tr>
</table>
posted on 2007-12-21 20:54
crazy 阅读(202)
评论(0) 编辑 收藏 所属分类:
javasrcipt