爲了讓我打印預覽「接受」的風格,我需要,包括我的彈出窗口,我使用的打印中的一個函數:如何包括window.open內的jQuery函數
功能我使用的打印是:
$('#printPersonnel').click(function() {
var data = document.getElementById('personnelTable').outerHTML;
var mywindow = window.open('', data);
mywindow.document.write('<html><head><title>NORA Loading</title>');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Content/Site.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Scripts/examples-offline.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Scripts/kendo.rtl.min.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Scripts/kendo.common.min.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Scripts/kendo.dataviz.default.min.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Scripts/kendo.dataviz.min.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="http://localhost:49573/Scripts/kendo.default.min.css">');
mywindow.document.write('</head><body>');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.focus();
mywindow.print();
mywindow.close();
return true;
});
不過,我需要包括以正確添加此格式(我使用Telerik的UI格)一$(document).ready
功能。
這意味着,我需要包括我的文檔中的腳本標記。
我的問題在於試圖添加結束腳本標籤(它把自己看作父頁面的一部分,而不是內部的功能)。
任何建議,我怎麼能實現這個功能?
我想某個表的標籤,這是在文件準備在頁面加載看作是一個Telerik的網格格式化內打印一切
編輯
我的問題是與mywindow腳本的結束標記:
mywindow.document.write('});');
mywindow.document.write('</script>'); //issue with this line/seen as esc sequence (i think)
你能提供包括''」);'工作,可能是問題在於裏面'.ready'函數體,語法錯誤還是什麼? – Zudwa 2014-12-04 12:57:26