问题描述
我想用现有数据打开新的打印对话框.我写了以下代码
i want to open new print dialog with existing data. i write follwing code
print: function (dialog) {
var printW = window.open("");
var d = $("#" + dialog);
var html = "<link href='" + baseURL + "Content/Styles/ui-lightness/jquery-ui.min.css' rel='stylesheet'/><link href='" + baseURL + "Content/Styles/ui-lightness/jquery.ui.theme.css' rel='stylesheet'/><link type=\"text/css\" rel=\"stylesheet\" href=\"" + baseURL + "Content/Styles/Site.css\">";
html += "<div class=\"ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable\" style=\"outline: 0px none; z-index: 1002; position: absolute; height: auto; width: 800px; display: block;\" role=\"dialog\" aria-labelledby=\"ui-id-1\">";
html += "<div id=" + dialog + " class=\"inner ui-dialog-content ui-widget-content\" style=\"width: auto;height:auto;\" scrolltop=\"0\" scrollleft=\"0\">";
d.find(".buttons").hide();
html += d.html();
html += "</div>";
printW.document.write(html);
printW.document.close();
printW.focus();
printW.print();
d.find(".buttons").show();
printW.close();
}
上面的代码对于Internet Explorer来说是正确的,但不适用于chrome浏览器.
该行发生错误
printW.document.write(html);
错误是:PrintW的未定义类型文档.
请帮助
正确的pre
标签.
[/Edit]
the above code working correct for Internet Explorer but it''s not working with chrome browser.
error occurred for this line
printW.document.write(html);
and error is: undefined type document for PrintW.
please help
Correct pre
tags.
[/Edit]
推荐答案
上面的代码对于Internet Explorer来说是正确的,但不适用于chrome浏览器.
该行发生错误
printW.document.write(html);
错误是:PrintW的未定义类型文档.
请帮助
正确的pre
标签.
[/Edit]
the above code working correct for Internet Explorer but it''s not working with chrome browser.
error occurred for this line
printW.document.write(html);
and error is: undefined type document for PrintW.
please help
Correct pre
tags.
[/Edit]
这篇关于如何使用JavaScript使用数据打开新的打印对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!