473,387 Members | 1,517 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,387 software developers and data experts.

printing problem in frames using javascript

meenakshia
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 try to open a page on the right and print two different pages using iframes it does not work ,
on the contrary when i load the page without frames it does the print job perfectly.i fail to understand why this is happening
i m posting the partial code as the main code is too long and is not relevant for this issue.
the following is the code
pls suggest me some way out
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.  
  3. function printPg(ifrmname){
  4.             if(top.frames[ifrmname]){
  5.                 top.frames[ifrmname].focus();
  6.                 top.frames[ifrmname].print();
  7.             }
  8.         }
  9. </script>
  10. <td>
  11. <iframe name="one" width="0" height="0" frameborder="0" src="E:/anand/program/final/databaseos/data/custprint.htm"></iframe>
  12.  
  13. <iframe name="two" width="0" height="0" frameborder="0" src="E:/anand/program/final/databaseos/data/factprint.htm"></iframe>
  14.  
  15. <a href="#" onclick="printPg('one');return false;">Print Customer Copy</a>
  16.  
  17. <a href="#" onclick="printPg('two');return false;">Print Factory Copy</a>
  18. </td>
  19.  
---smile always
anand
Sep 9 '08 #1
3 1963
acoder
16,027 Expert Mod 8TB
I haven't tested, but I don't think the iframes within a frame will be in the main page frames array. You could use JavaScript to make the print style sheet change to the selected iframe when a link is clicked.
Sep 10 '08 #2
hi
problem solved
i used a hit and trial method with success:)
top.frames[ifrmname]
i removed top as it was not refering to right frame and it worked:)
thanks anyways
smile always
anand
Sep 10 '08 #3
acoder
16,027 Expert Mod 8TB
So frames[ifrmname] worked? It should do.

Anyway, glad you've got it to work.
Sep 10 '08 #4

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

Similar topics

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...
1
by: Starfire | last post by:
I have a script for printing the contents of a frame. It works fine but I would like it not only to print the designated frame but to add a header or message at the top or bottom. Anyone know...
1
by: Heinz | last post by:
Hi together, I like to print several hidden frames out of a "Printing-Frame". Normally, I can use the window.focus() and window.print() function of javascript. Because, I like to print out five...
1
by: Heinz | last post by:
Hi @ all, I try to print out five hidden frames throug a printing-form. I use the frame.focus() and the frame.print() functions. Everything is fine except the following little disadvantage: ...
1
by: Richard Brand | last post by:
We run into a strange problem with a client when printing a frame from a website. On the site there is a button that performs the following javascript code: parent.myFrame.focus();...
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
1
by: sconeek | last post by:
hi all, I am working on a virtual keyboard. the page is a combination of html and javascript. the html page is made up of a lot of frames. now i am unable to implement the actual keyboard...
2
by: PieOPah | last post by:
I have a webpage that uses frames (yes I know, frames - previously been flamed about that, but I do not know anything else to use since I am clueless!!! Been asked to cobble together a site since...
1
by: harshavardhan | last post by:
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.