JS實現(xiàn)彈出居中的模式窗口示例
本文實例講述了JS實現(xiàn)彈出居中的模式窗口。分享給大家供大家參考,具體如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JS彈出窗口</title> </head> <body> <script src="jquery-1.7.2.min.js" type="text/javascript"></script> <script> function OpenDialog(url,w, h) { var iTop2 = (window.screen.availHeight - 20 - h) / 2; var iLeft2 = (window.screen.availWidth - 10 - w) / 2; var params = 'menubar:no;dialogHeight=' + h + 'px;dialogWidth=' + w + 'px;dialogLeft=' + iLeft2 + 'px;dialogTop=' + iTop2 + 'px;resizable=yes;scrollbars=0;resizeable=0;center=yes;location:no;status:no' var addDiv = $("<div id = 'tempDiv' style='left:0px;top:0px;position:absolute;width:100%;height:100%;background:rgba(0,0,0,0.4)!important;filter:alpha(opacity = 40);background:#000;z-index:1000;'></div>"); $(document.body).append(addDiv); //添加一個蒙板作背景 window.open(url, addDiv, params); } OpenDialog("http://www.dbjr.com.cn",300,300); </script> </body> </html>
更多關于JavaScript相關內(nèi)容感興趣的讀者可查看本站專題:《JavaScript切換特效與技巧總結》、《JavaScript查找算法技巧總結》、《JavaScript動畫特效與技巧匯總》、《JavaScript錯誤與調試技巧總結》、《JavaScript數(shù)據(jù)結構與算法技巧總結》、《JavaScript遍歷算法與技巧總結》及《JavaScript數(shù)學運算用法總結》
希望本文所述對大家JavaScript程序設計有所幫助。
相關文章
window resize和scroll事件的基本優(yōu)化思路
在項目中使用scroll事件去加載數(shù)據(jù),結果IE下悲劇了。下面為大家介紹下window resize和scroll事件的基本優(yōu)化思路,需要的朋友可以參考下2014-04-04JavaScript正則表達式小結(test|match|search|replace|split|exec)
這篇文章主要介紹了JavaScript正則表達式小結(test|match|search|replace|split|exec)的相關資料,非常不錯,具有參考借鑒價值,需要的朋友參考下吧2016-12-12javascript 對象 與 prototype 原型用法實例分析
這篇文章主要介紹了javascript 對象 與 prototype 原型用法,結合實例形式分析了javascript 對象 與 prototype 原型實現(xiàn)對象創(chuàng)建、繼承、拷貝等相關操作技巧,需要的朋友可以參考下2019-11-11URLSearchParams快速解析URL查詢參數(shù)實現(xiàn)
這篇文章主要為大家介紹了URLSearchParams快速解析URL查詢參數(shù)實現(xiàn),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-06-06