亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        Javascript中封裝window.open解決不兼容問(wèn)題

        字號(hào):


            對(duì)window.open進(jìn)行封裝, 使其更好用, 且更兼容, 很多人說(shuō)window.open不兼容,其實(shí)不是, 因?yàn)椴荒苤苯訄?zhí)行, 必須通過(guò)用戶手動(dòng)觸發(fā)才行;看代碼:
            代碼如下:
            ?1234567891011121314151617181920212223242526272829 var openWindow = function(url, options) { var str = ""; if (options) { options.height = options.height || 420; options.width = options.width || 550; options.left = options.left || ((screen.width - options.width) / 2); //默認(rèn)為居中 options.top = options.top || ((screen.height - options.height) / 2); //默認(rèn)為居中 for (var i in options) { str += ',' + i + '=' + options[i]; } str = str.substr(1); }; window.open(url, 'connect_window_'+ (+new Date), str);//參數(shù)1為url,參數(shù)2為了能可以重復(fù)彈出 str = null; }; //demo 1:新窗口打開(kāi)我的led投光燈電源網(wǎng)站 document.body.onclick = function(){ openWindow(" ?rel=xuexb"); } //demo 2:固定寬 并居中 document.body.onclick = function(){ openWindow?rel=xuexb",{ width:888 }); }