1. 程式人生 > >Js:彈窗劇中

Js:彈窗劇中

js變數設定

    var iWidth = $(window).width() * 0.9;
    var iHeight = $(window).height() * 0.9;
    var iTop = (window.screen.height - 30 - iHeight) / 2;
    var iLeft = (window.screen.width - 10 - iWidth) / 2;
var tgUrl="https://www.baidu.com/";
js彈出窗體


        //彈窗方式開啟
        var ifraDoc = $("<iframe id=\"viewDoc\" src='
" + tgUrl + "' style=\"height: " + iHeight + "px; padding: 10px; width: " + iWidth + "px; \" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" height=\"0px\" width=\"0px\" ></iframe>"); $(ifraDoc).dialog({ autoOpen: true, modal: true, title: "文件預覽" }); //新開頁籤方式開啟 //window.open(tgUrl, "_blank", "status=no,toolbar=no,menubar=no,location=no,titlebar=no,scrollbars=no,resizable=yes,modal=true,alwaysRaised=yes,width=" + iWidth + ",height=" + iHeight + ",top=" + iTop + ",left=" + iLeft+"");