兼容ie,firefox window.showModalDialog


 

計算Dialog居中位置。

function CalcShowModalDialogLocation(dialogWidth, dialogHeight) {
     var iWidth = dialogWidth;
     var iHeight = dialogHeight;
     var iTop = (window.screen.availHeight - 20 - iHeight) / 2;
     var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
     return 'dialogWidth:' + iWidth + 'px;dialogHeight:' + iHeight + 'px;dialogTop: ' + iTop + 'px; dialogLeft: ' + iLeft + 'px;center:yes;scroll:no;status:no;resizable:0;location:no';
}

 

調用Dialog位置方法。 

  var DialogLocation = CalcShowModalDialogLocation(500, 260);
                 var result = window.showModalDialog("URL", window, DialogLocation);

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM