473,378 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 3569
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

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

Similar topics

by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
by: Dan Popa | last post by:
Check out the following 2 links: http://www.batisdev.com/admin/test_1images.asp http://www.batisdev.com/admin/test_2images.asp First page contain 4 IFRAMES and 1 IMG tags. Second page contain 4...
by: Marina Ferguson | last post by:
Hi, I have a document with an iframe. The main doc has a "Print" button. The idea is that when the user clicks it, the contents of the iframe is printed. For some reason instead of the iframe...
by: Arne Hendrickson | last post by:
Can anyone tell me how to edit this script for "traditional frames" to work with iframes? SCRIPT language="JavaScript"> <!----hide function change2() { parent.left_frame.location="page3.htm";...
by: Alan Lue | last post by:
Hi, I'm trying to set up a webpage so that I can view multiple HTML files from the same page. For example, you might go to http://example.com/lab_tests.html and be able to view lab1.html,...
by: nightstar | last post by:
I am creating a web page that will contain multiple Iframes. One of the Iframes will contain a bill of sale that is generated by a script on x.mydomain.com/somefile.php?someparameters. One of the...
by: Giggle Girl | last post by:
Is there a way to use Javascript to detect if a browser supports IFrames, or (if it DOES support them) that IFrame use is enabled? Thanks, Ann
by: wmanzo | last post by:
I have a really professional conspiracy movie site and I use tons of layers and an external scroll bar assembly. I would like to put the various sections into MS Iframes and in order to clean up...
by: meenakshia | last post by:
hi forum i m facing a problem regarding printing withing the frames page i have a main frame page. which has on the left the menu html page loaded and on the right the target content page. when i...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.