本文實例講述了JS CSS實作可拖曳的彈出提示框。分享給大家供大家參考。具體實作方法如下: 複製代碼 代碼如下: JS CSS打造的可拖曳的彈出提示框 <br /> a{ color:#000; font-size:12px;text-decoration:none}<br /> a:hover{ color:#900; text-decoration:underline}<br /> body{background:;filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#003366); overflow:hidden}<br /> #massage_box{ position:absolute; left:expression((body.clientWidth-350)/2); top:expression((body.clientHeight-200)/2); width:350px; height:200px;filter:dropshadow(color.color =#666666,offx=3,offy=3,positive=2); z-index:2; visibility:hidden}<br /> #mask{ position:absolute; top:0; left:0; width:expression(body.scrollWidth);height:expression(body.scrollHeight); background:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-indexbackground:#666; filter:ALPHA(opacity=60); z-index後:1; visibility:hidden}<br /> .massage{border:#036 solid; border-width:1 1 3 1; width:95%; height:95%; background:#fff; color:#036; font-size:12px; line-height:150% }<br /> .header{background:#036; height:10%; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding:3 5 0 5; color:#fff}<br /> <br /> var Obj=''<br /> document.onmouseup=MUp<br /> document.onmousemove=MMove<br /> function MDown(Object){<br /> Obj=Object.id<br /> document.all(Obj).setCapture()<br /> pX=event.x-document.all(Obj).style.pixelLeft;<br /> pY=event.y-document.all(Obj).style.pixelTop;<br /> } <p>function MMove(){<br /> if(Obj!=''){<br /> document.all(Obj).style.left=event.x-pX;<br /> document.all(Obj).style.top=event.y-pY;<br /> }<br /> } <p>function MUp(){<br /> if(Obj!=''){<br /> document.all(Obj).releaseCapture();<br /> Obj='';<br /> }<br /> }<br /> × 點此提示 希望本文所述對大家的javascript程式設計有所幫助。