<body οnmοusemοve="moveIt();" οnmοuseup="end();" οndragstart="return false;">
<script>
var isDrag = false;
var oldX=0,oldY=0;
function init(){
isDrag=true;
oldX=event.x;
oldY=event.y;
}
function end(){
isDrag=false;
}
function moveIt(){
if(isDrag){
var x =window.event.x;
var y = window.event.y;
hdl.parentNode.style.left = parseInt(hdl.parentNode.style.left.replace("px","")) + (x - oldX);
hdl.parentNode.style.top = parseInt(hdl.parentNode.style.top.replace("px","")) + (y - oldY);
oldX = x;
oldY = y;
}
}
</script>
<div id="back" οnmοusemοve="moveIt();" οnmοuseup="end();" style="position:absolute;left:0;top:0;width:1000;height:660;visibility:hidden;"> </div>
<div οnmοusedοwn="init();" οnmοusemοve="moveIt();" οnmοuseup="end();" style="border:1px outset #333333;position:absolute;filter:alpha(opacity=70);top:0;left:0;width:400;height:300">
<div id="hdl" style="background:#333377;width:100%;height:20;color:white"><b>窗口</b></div>
<div style="background:#dddddd;width:100%;height:280">
<input type="button" value="变暗效果" οnclick="back.style.background='#333333';back.style.filter='alpha(opacity=40)';back.style.visibility='';">
</div>
</div>
</body>