gpt4 book ai didi

javascript - Javascript : open one window print that one and than close it than open one new window

转载 作者:行者123 更新时间:2023-11-30 20:58:33 33 4
gpt4 key购买 nike

我的要求是,我需要打开两个窗口,但第二个窗口必须在第一个窗口打印并关闭后打开。可能吗?

但第二个窗口与第一个窗口同时打开。

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');}

打印

最佳答案

$(function(){
OpenFirstWindow()
})
var mywindow;
var mywindow2;
function OpenFirstWindow(){
mywindow= window.open('')
mywindow.document.write('<html><head><title>TITLE</title><body onload="">');
mywindow.document.write("window 1");
mywindow.document.write('</body></html>');
mywindow.print();
mywindow.close()
OpenSecondWindow();

}


function OpenSecondWindow(){
mywindow2= window.open('')
mywindow2.document.write('<html><head><title>TITLE</title><body >');
mywindow2.document.write("window 2");
mywindow2.document.write('</body></html>');
mywindow2.document.close();
mywindow2.print();
mywindow2.close()

}

关于javascript - Javascript : open one window print that one and than close it than open one new window,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47374728/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com