Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a pop-up window

Status
Not open for further replies.

SPYDERIX

Technical User
Jan 11, 2002
1,899
CA
I currently have the following code which doesn't report any errors nor does it print succesfully.

<script language=&quot;JavaScript&quot;>

var myText=12345;
var myWindow = window.open('','windowName','width=400,height=400');
myWindow.document.write(myText);

</script>
<html>
<head>
<title>Untitled</title>
</head>

<body>
<form>
<input type=&quot;button&quot; value=&quot;Print contents of popup&quot; onclick=&quot;(window.print){windowName.print();}&quot;>
</form>


</body>
</html>

Can anyone find my error?
 
try myWindow.print(); Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
this will work for sure, I tried it first to make sure it did.

<FORM>
<input type=button name=print value=&quot;Print&quot; onClick=&quot;javascript:window.print()&quot;>
</FORM>

source: [deejay]
Nate
&quot;If you're not living on the edge, you're taking up too much space!&quot;
 
toetag,
You didn't open the document correctly, may be this is the problem. Here's how you should do it:

var myWindow = window.open('',' ....
myWindow.document.open();
myWindow.document.write(' ....
myWindow.document.close();

Check this and tell what happens.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top