471,337 Members | 1,219 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

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.

<script language="javascript">
var len = 0; var i = 0; var t;
function printAll(){
len = document.frames.length;
for(var i=0;i<len;i++){

<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>

Thanks in advance.
May 16 '07 #1
1 3460
1,208 Expert 1GB
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>
  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>
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
4 posts views Thread by Arne Hendrickson | last post: by
8 posts views Thread by Alan Lue | last post: by
2 posts views Thread by nightstar | last post: by
3 posts views Thread by Giggle Girl | last post: by
19 posts views Thread by wmanzo | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.