【发布时间】:2018-05-02 15:38:41
【问题描述】:
我的要求是,我需要打开两个窗口,但第二个窗口必须在第一个窗口打印并关闭之后打开。有可能吗?
但第二个窗口与第一个窗口同时打开。
HTML/JSP 代码 打印
Java 脚本 函数打印(id){
var data=document.getElementById(id).innerHTML;
var mywindow = window.open("",'TITLE','left=0,top=0,width=800,height=400,channelmode=no,titlebar=yes,scrollbars=yes,toolbar=no,menubar=no,resizable=yes,copyhistory=no,directories=no,status=yes');
mywindow.document.write('<html><head><title>TITLE</title>');
mywindow.document.write("<style type='text/css'>");
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.focus();
mywindow.print();
mywindow.close();
return true;
}
函数弹出(){ var mysecondWindow = window.open("",'SecUtdOfficialWebsite','width=400,height=400'); }
打印
【问题讨论】:
-
HTML 代码:从哪里触发 java 脚本函数 button type="button" onclick="if(print('test1')){popup();}" >Print跨度>
-
有afterprint 事件,但没有得到广泛支持。
-
好的。谢谢!让我看看这是否适合我。
标签: javascript html