|
Subject:
|
print()
|
|
Posted By:
|
Snib
|
Post Date:
|
1/1/2004 1:41:56 PM
|
I have a page that when the user clicks a button, it should open a popup and print it.
However, what I am doing is opening a blank page and writing on it, then telling it to print from the opener.
Nothing happens when I use this code:
//onclick fires this function:
function print_page()
{
//this part works fine...
var newpage = window.open("","newpage");
//this part works fine...
newpage.document.write("a bunch of data");
//this part does nothing!
newpage.window.print();
//I have also tried:
newpage.print();
newpage.document.print();
//and several other things...
}
Perhaps this is some sort of security issue? I get no errors, just nothing...
Thanks
Snib
|
|
Reply By:
|
joefawcett
|
Reply Date:
|
1/2/2004 10:57:45 AM
|
You need to close document before printing:
newpage.document.write("a bunch of data...");
newpage.document.close();
newpage.print();
--
Joe
|
|
Reply By:
|
Snib
|
Reply Date:
|
1/2/2004 11:05:32 AM
|
Thank you Joe, works perfectly.
|