JS彈出對話框(遮罩)透明,可拖動的簡單實例
<html> <head> <script>函數salert(txt){// var esrc =(document.all)? “ 0px”; shield.Style.width =“ 100%”; // window.alert(document.body.scrollheight); shield.Style.Style.height = document.body.scrollheight+px+“ px”; shield.Shield.Shield.Style.shield.Style.back =“ White” white white; =“ alpha(不透明度= 80)”; shield.Style.opacity = 0.8; // shield.style.border-width =厚; strhtml =“ <input type type type =/” button/“ valut =/” value =/“ id =/” id =/“ id =/” do_ok/“ do_ok/” strHtml;document.body.appendChild(shield);this.doOk = function(){document.body.removeChild(shield);}document.getElementById("do_OK").focus();}</script></head><body ><input type=button onclick="sAlert('登陸成功!')" value=登陸><p Align = Center> <Select> <Option> --- </option> </option> </oflect> </p> </hody> </html> <html> <head> <script> var dragAppravy = falsevar minrestore = 0 //該變量表示窗口目前的狀態,0表示初始化狀態,1表示最大化狀態var intirlwidth,initialHeight //初次//若client瀏覽器為ie5.0瀏覽器為ie5.0 v var ie5 = iecompattest(){return(!window..opera && document.compatmode && document.compatmode!=“ backcompat”)? document.documentElement:document.body}函數drag_drop(e){如果(ie5 && dragAppReved && event.button == 1){document.getElementById(“ dwindow”) (ns6 && dragAppRaved){document.getElementById(“ dwindow”)。 style.left = tempx+e.clientx offsetx+“ px” document.getElementById(“ dwindow”)。 event.clientx:e.clientxoffsety = ie5? event.clienty:e.clientydocument.getElementById(“ dwindowcontent”)。 style.display =“ none” //此句代碼可不要tempx = parseInt(document.getElementById(“ dwindow”)。樣式.left)tempy = parseInt(document.getElementById(“ dwindow”)。style.top)dragAppRoved = trueDocument.getElementByid(getElementByid)(“ dwindow”) (!ie5 &&!ns6) //若不為ie或netscpae瀏覽器,window = 1“){} else {document.getElementById(“ dwindow”)。style.display =''; document.getElementById(“ dwindow”)。樣式。 width = inationWidth = width+“ px”; document.getElementById(“ dwindow”)。style.height = initialHeight = heightheight = height = height+“ px”; document.getElementByid(“ dwindow”)。 window.pageyoffset*1+30+“ px”:iecompattest()。scrolltop*1+30+“ px”; // document.getElementById(“ cframe”)。src = url}} function aximizize() windowdocument.getElementById(“ maxName”)。setAttribute(“ src”,“ layout.png”)document.getElementByid(“ dwindow”)。style.width = ns6? window.innerwidth-20+“ px”:iecompattest()。clientwidth+“ px” document.getElementById(“ dwindow”)。style.height = ns6? window.innerheight-20+“ px”:iecompattest()。clientheight+“ px”} else {minrestore = 0 // Restore windowdocument.getElementById(“ maxName”)。setAttribute(“ src”,“ layout.png”)document.getElementByid(“ dwindow”)。style.width = in itialWidthDocument.getElementById(“ dwindow”)。style.height = initialHeight} document.getElementById(“ dwindow”)。style.left = ns6? window.pagexoffset+“ px”:iecompattest()。scrollleft+“ px” document.getElementById(“ dwindow”)。style.top = ns6? window.pageyOffset+“ px”:iecompattest()。scrolltop+“ px”} function collectit(){document.getElementById(“ dwindow”)。style.display =“ none”}函數stopdrag(){dragAppraved = false; document.getElementById(“ dwindow”)。onmousemove = null; document.getElementById(“ dwindowcontent”)。style.display =“ // foxe style =“位置:絕對;背景色:# id =“ maxName” onclick =“ maximize()”> <img src =“ icon_delete.gif” onclick =“ collectit() OnClick ='loadWindow(300,200);'> </body> </html>以上這篇js彈出對話框(遮罩)透明,可拖動的簡單實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。 ,也希望大家多多支持武林網。