弹出窗口的HTML如下:
<!DOCTYPE html>
<head>
<script type="text/javascript" src="../jquery/jq/jquery-1.9.1.min.js"></script>
</head>
<html>
<body>
<div id="revi_sec_report_container"></div>
</body>
</html>JQUERY库的路径是正确的...
我用下面的代码打开弹出窗口:
var x = false;
$('#revi_print').unbind();
$('#revi_print').click(function() {
x = window.open('report_handle/print.php?filter_report=' + $('#revi').data('filter_report'), "Popup", "width=580, height=360, scrollbars=yes, toolbar=no, status=no, resizable=yes, menubar=no, location=no, directories=no, top=10, left=10");
x.addEventListener('load', handle_popup, false);
});这是应该使用JQUERY修改弹出窗口的实际内容的部分:
function handle_popup() {
x.document.$('body').append('TEST');
}虽然可以在弹出窗口中使用原生JavaScript,如getElementById等,但不能使用JQUERY...
我在firebug中得到以下错误消息:
x.document.$ is not a function
x.document.$('body').append('TEST');发布于 2016-08-19 16:11:06
我自己也刚刚发现...
function handle_popup() {
x.$('body').append('TEST');
}在使用JQUERY访问x.文档之前,我不应该使用它。
https://stackoverflow.com/questions/39033947
复制相似问题