免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Javascript window.open和print導(dǎo)致IE8掛起

我正在嘗試使用window.open()創(chuàng)建一個(gè)然后打印的彈出窗口,但是我遇到問題,IE8掛起后彈出它.

更多詳情:

在我的應(yīng)用程序結(jié)束時(shí),我正在嘗試打印輸出的信息,但我試圖在該彈出窗口中包含單獨(dú)的CSS,jQuery和Javascript.我認(rèn)為正是這些外部鏈接導(dǎo)致IE8掛斷,但我不確定.

在我測試的所有其他瀏覽器中發(fā)生的事情是彈出窗口,出現(xiàn)打印對話框,打印正常.

在IE8中,窗口彈出,內(nèi)容出現(xiàn),CSS似乎加載,但不是Javascript.如果您嘗試手動(dòng)打印(Ctrl P),它將打印而不使用CSS.

我試過這里的例子:
Script elements written with document.write in a window opened with window.open are not executed in IE8 on Windows 7

現(xiàn)場演示

如果您想查看實(shí)時(shí)版本,請?jiān)L問:http://roxulmaterialscalculator.com/
如果您想要到達(dá)打印部分,則必須填寫應(yīng)用程序所需的信息. (第二步,只需填寫無線電輸入).

要查看完整的javascript:http://roxulmaterialscalculator.com/js/scripts.js,您將在其中找到我嘗試過的其他方法.

將元素傳遞給函數(shù)

$('#actionPrint').live('click', function(event){    printElem('#rc');}

彈出元素并打印出來.

function printElem(elem) {    popup($j(elem).html());} function popup(data) {    var mywindow = window.open('', 'printSheet', 'height=500,width=800,scrollbars=1');    mywindow.document.open();    mywindow.document.write('<html><head><title>Roxul Insulation Calculator</title>');    mywindow.document.write('</head><body>');    mywindow.document.write('<div id="rc_logo"><img src="img/roxul-logo.png" alt="roxul-logo" /></div>');    mywindow.document.write(data);    mywindow.document.write('</body></html>');    var c = mywindow.document.createElement("link");        c.rel = "stylesheet";        c.type = "text/css";        c.href = "css/print.css";        mywindow.document.getElementsByTagName("HEAD")[0].appendChild(c);    var s = mywindow.document.createElement("script");        s.type = "text/javascript";        s.src = "js/jquery-1.5.2.min.js";        mywindow.document.getElementsByTagName("HEAD")[0].appendChild(s);    var s2 = mywindow.document.createElement("script");        s2.type = "text/javascript";        s2.src = "js/print.js";        mywindow.document.getElementsByTagName("HEAD")[0].appendChild(s2);    mywindow.print();    return true; }

解決方法:

我已經(jīng)解決了我自己的問題,所以希望回答一個(gè)人自己的問題并不是壞事.

我的錯(cuò)誤不包括mywindow.document.close();在我的功能結(jié)束時(shí).
現(xiàn)在看起來如下:

mywindow.print();mywindow.document.close();return true;

我與其中一位與我合作的開發(fā)人員交談,他說document.close()會(huì)釋放要打印的資源.

來源:https://www.icode9.com/content-1-437201.html
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
在一個(gè)頁面,根據(jù)不同瀏覽器調(diào)用不同CSS或JAVASCRIPT
經(jīng)常用到的 三種JavaScript進(jìn)度條
javascript面試題,提高版 吐槽+解析
JavaScript仿淘寶智能浮動(dòng)
關(guān)于 contentWindow, contentDocument
Firefox和IE之間7個(gè)JavaScript差異
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服