I know how to print and iframe from the parent:
document.frames('iPrint').focus();
document.frames('iPrint').print();
but how do you print from the iframe itself. I am passing an id from the parent to the iframe and then submitting the form on the iframe to call an sub that produces the html content. If I try to print from the parent the sub takes to long to run so it prints a blank page. I am trying to add a print block at the end of the sub so whenver it is through loading it will print itself.
iframe:
Code:
<%
Sub mySub()
a bunch of code
'at the end write out javsscript
******THIS IS THE PROBLEM****
<script>window.print()</script> ---doesnt do anything
<script>document.frames('iPrint').focus();
document.frames('iPrint').print();</script> ----throws an error ("Exception")
**************************
End Sub
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<link rel="STYLESHEET" type="text/css" media="print" href="media/print.css">
</HEAD>
<BODY>
<form name="frmPrint" method="post" action="print.asp">
<input type="hidden" name="hdnagtmgrID">
</form>
<%
If Len(Request.Form("hdnagtmgrID")) > 0 Then
AgcyChgs(Request.Form("hdnagtmgrID"))
End If
%>
</BODY>
</HTML>
Thanks in advanvce