On Feb 17, 7:34 pm, "Kevin Darling" <kdarl...@basit.comwrote:
>
Why not pick out the response from the iframe?
Or set the focus to the iframe and then it'll print instead.
Kev
Kev,
I tried using the innerHTML and innerText of the iframe to get the
response text, but they are empty. Do you know how to get the text
content from an iframe in JavaScript?
As far as the printing goes, I want to print the response text along
with other info on the page. The other info is in a div. Right know, I
write the response text to a cookie on the server when it's ready. My
onClick function for the Print button checks the cookie. If the cookie
exists, I grab the response text, put it in the innerText of a span
within my div, and print the innerText of the whole div.
The JavaScript code for the printing is as follows:
// summaryDiv contains everything that is to be printed,
// including the response span
var summaryDiv = document.getElementById("summaryDiv");
var WinPrint = window.open('','','letf=0,top=0,width=1,
height=1,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(summaryDiv.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
If you or anybody has any ideas about a better way to the print, how
to get the text content of an iframe, or any thoughts on the AJAX vs.
Cookies issue, I'd love to hear from you.
Thanks.
Doug