我不知道這樣的功能叫什麼,找了好久也沒有找到,所以來找大家協助了,在此謝謝了。
我的目的是這樣的,就是在原有頁面基礎上,彈出一個新窗,同時原來的頁面偏灰色,並且不能操作,必須在彈出的新窗關閉後才能恢複原來視窗的操作。具體效果有點象lightbox和thickbox,我現在是想用thickbox,它可以實現這種舊頁面變灰的效果,但是沒有辦法實現舊頁面不能操作的問題。(要在firefox和ie下都能使用,ie的showModalDialog是可以實現這樣的目的,但是firefox下不能用啊)
<body onmousemove="moveIt();" onmouseup="end();" ondragstart="return false;" > <input type="button" value="關閉?" onclick="back.style.background='#333333';back.style.filter='alpha(opacity=40)';back.style.visibility='';wnd.style.display='inline';"> <script> var isDrag = false; function execCode(){ var newWin = window.open(); newWin.document.write(tt.value); } 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" onclick="cancels.click();" onmousemove="moveIt();" onmouseup="end();" > </div> <div id="wnd" onmousedown="init();" onmousemove="moveIt();" onmouseup="end();" > <div id="hdl" ><b>視窗</b></div> <div > <input type="button" value="確定" onclick="opener=null;window.close()"><input type="button" value="取消" id="cancels" onclick="back.style.visibility='hidden';wnd.style.display='none';"> </div> </div> </body>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]