Home > front end >  Print preview returned after modal dialog close button can't use, ask for help.
Print preview returned after modal dialog close button can't use, ask for help.

Time:10-12

Print preview close to return to the original modal dialog, close button can't use, bosses help

CodePudding user response:

From the top the top from the top

CodePudding user response:

 function doPrint3 () {
//whether the iframe exists, does not exist, create the iframe
Var iframe=document. GetElementById (" print - the iframe ");
if(! The iframe) {
Var el=document. GetElementById (" printcontent ");
The iframe=document. The createElement method (" iframe ");
Var doc=null;
The iframe. SetAttribute (" id ", "print - the iframe");
The iframe. SetAttribute (' style ', 'position: absolute; Width: 0 px; Height: 0 px; Left: - 500 px; Top: - 500 px; ');
Document. The body. The appendChild (iframe);
Doc=iframe. ContentWindow. Document;
//here you can customize the style
//doc. Write (" & lt; LINK rel="stylesheet" type="text/CSS" href="https://bbs.csdn.net/topics/css/print.css" & gt;" );
Doc. Write (' & lt; Div> '+ el. InnerHTML + & lt;/div> ');
Doc. The close ();
The iframe. ContentWindow. Focus ();
}
The iframe. ContentWindow. Print ();
If (the navigator userAgent. IndexOf (" MSIE ") & gt; 0 {
Document. Body. RemoveChild (iframe);
}
}


With the implementation of the above part printed page

CodePudding user response:

No points before the "print", "close" to close this?

CodePudding user response:

The
reference 3 floor trainee response:
no point before the "print", "close" to close this?

CodePudding user response:

refer to the second floor baiy20151018b response:
 function doPrint3 () {
//whether the iframe exists, does not exist, create the iframe
Var iframe=document. GetElementById (" print - the iframe ");
if(! The iframe) {
Var el=document. GetElementById (" printcontent ");
The iframe=document. The createElement method (" iframe ");
Var doc=null;
The iframe. SetAttribute (" id ", "print - the iframe");
The iframe. SetAttribute (' style ', 'position: absolute; Width: 0 px; Height: 0 px; Left: - 500 px; Top: - 500 px; ');
Document. The body. The appendChild (iframe);
Doc=iframe. ContentWindow. Document;
//here you can customize the style
//doc. Write (" & lt; LINK rel="stylesheet" type="text/CSS" href="https://bbs.csdn.net/topics/css/print.css" & gt;" );
Doc. Write (' & lt; Div> '+ el. InnerHTML + & lt;/div> ');
Doc. The close ();
The iframe. ContentWindow. Focus ();
}
The iframe. ContentWindow. Print ();
If (the navigator userAgent. IndexOf (" MSIE ") & gt; 0 {
Document. Body. RemoveChild (iframe);
}
}


With the implementation of the above part printed page
hello, I use the method of no form of frame line

CodePudding user response:

JoeymaJ
reference 4 floor response:
Quote: refer to 3rd floor trainee response:

No points before the "print", "close" to close this? The
can

Window. It is because when the printing document. Body. InnerHTML=BDHTML this statement
If BDHTML contains scripts, innerHTML to assign a value, the script is a failure, there are many online solutions, general is to find script to delete the assignment again, the following function for reference (if you have multiple scripts to change the function)
 
The function regen_script (obj) {
Var oScript=obj. GetElementsByTagName (' script ') [0];
if(! The empty (oScript)) {
Obj. RemoveChild (oScript);
Var newScript=document. The createElement method (' script ');
NewScript. Type='text/javascript';
NewScript. InnerHTML=oScript. InnerHTML;
Obj. The appendChild (newScript);
}
}


Regen_script (window. The document. The body);

You also can use the second floor plan to print, pay attention to the CSS to as well as female parent, or print effect is not the same as

CodePudding user response:

reference 5 floor joeymaJ reply:
Quote: refer to the second floor baiy20151018b response:

 function doPrint3 () {
//whether the iframe exists, does not exist, create the iframe
Var iframe=document. GetElementById (" print - the iframe ");
if(! The iframe) {
Var el=document. GetElementById (" printcontent ");
The iframe=document. The createElement method (" iframe ");
Var doc=null;
The iframe. SetAttribute (" id ", "print - the iframe");
The iframe. SetAttribute (' style ', 'position: absolute; Width: 0 px; Height: 0 px; Left: - 500 px; Top: - 500 px; ');
Document. The body. The appendChild (iframe);
Doc=iframe. ContentWindow. Document;
//here you can customize the style
//doc. Write (" & lt; LINK rel="stylesheet" type="text/CSS" href="https://bbs.csdn.net/topics/css/print.css" & gt;" );
Doc. Write (' & lt; Div> '+ el. InnerHTML + & lt;/div> ');
Doc. The close ();
The iframe. ContentWindow. Focus ();
}
The iframe. ContentWindow. Print ();
If (the navigator userAgent. IndexOf (" MSIE ") & gt; 0 {
Document. Body. RemoveChild (iframe);
}
}


With the implementation of the above part printed page
hello, I use the method of no form of box line



Written in the form of border style inline style a try,
  • Related