467,077 Members | 1,050 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

Printing IFRAMES using java script

Hi, here is the problem:
Consider there are three frames in a HTML page. When I try to print these frames using java script, only the third document is being printed thrice.

<HTML><HEAD>
<script language="javascript">
var len = 0; var i = 0; var t;
function printAll(){
len = document.frames.length;
for(var i=0;i<len;i++){
frames[i].focus();
frames[i].print();
}
}
</script>
</HEAD>

<BODY>
<input type="button" value="Print" onclick="javascript:printAll()">
<BR><iframe name="AF1" src="test1.doc"></iframe>
<BR><iframe name="AF2" src="test2.doc"></iframe>
<BR><iframe name="AF3" src="test3.doc"></iframe>
</BODY>
</HTML>

Thanks in advance.
May 16 '07 #1
  • viewed: 3356
Share:
1 Reply
iam_clint
Expert 1GB
Try
Expand|Select|Wrap|Line Numbers
  1. <HTML><HEAD>
  2. <script language="javascript">
  3. var len = 0; var i = 0; var t;
  4. function printAll(){
  5. len = document.frames.length;
  6. for(var i=0;i<len;i++){
  7. document.frames[i].focus();
  8. document.frames[i].print();
  9. }
  10. }
  11. </script>
  12. </HEAD>
  13.  
  14. <BODY>
  15. <input type="button" value="Print" onclick="javascriptrintAll()">
  16. <BR><iframe name="AF1" src="test1.doc"></iframe>
  17. <BR><iframe name="AF2" src="test2.doc"></iframe>
  18. <BR><iframe name="AF3" src="test3.doc"></iframe>
  19. </BODY>
  20. </HTML>
  21.  
also I don't know if you can call print that quickly meaning call it to print before you click print on the dialog box.
May 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Dan Popa | last post: by
4 posts views Thread by Marina Ferguson | last post: by
8 posts views Thread by Alan Lue | last post: by
2 posts views Thread by nightstar@gmail.com | last post: by
3 posts views Thread by Giggle Girl | last post: by
19 posts views Thread by wmanzo@yahoo.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.