473,839 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

printing problem in frames using javascript

33 New Member
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">
  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>
  13. <iframe name="two" width="0" height="0" frameborder="0" src="E:/anand/program/final/databaseos/data/factprint.htm"></iframe>
  15. <a href="#" onclick="printPg('one');return false;">Print Customer Copy</a>
  17. <a href="#" onclick="printPg('two');return false;">Print Factory Copy</a>
  18. </td>
---smile always
Sep 9 '08 #1
3 1988
16,027 Recognized Expert Moderator MVP
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
33 New Member
problem solved
i used a hit and trial method with success:)
i removed top as it was not refering to right frame and it worked:)
thanks anyways
smile always
Sep 10 '08 #3
16,027 Recognized Expert Moderator MVP
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

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 I get a print out of the whole page. I am using IE6. I spent several hours searching the groups but didn't find anything that works. Even when I do this: iframe_name.focus(); window.print();
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 how?? Thanx in advance Starfire
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 hidden frames, that meens, that there will be the print dialog (you choose on witch printer you want to print out) five times. Do anyboady know, how I can prevent this?
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: When I print out the five frames, the print window dialog appears five time (for each frame once). The user has to confirm his standard printer several times.
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(); window.print(); This is the normal way to print a specific frame from a website. Our client works on a SBS2003 with Terminal Server and when they hit the button all frames are printed out, not just the selected one. At first I thought that
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 button inside a-tag with attribute target isn't anything new relating ASP.Net, its same old HTML). He claimed that you could change another page´s controls´s property´s value from another frame by using this method: ' Page "Bottom"
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 functionality as i am unable to properly reference the frames. the top and bottom frames display some information and the middle frame has the keyboard with a couple of text fields. is there a way to print out the values within built-in variables like
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 there is a misconception that I know what I am doing!!!) Anyway, one of the things I have been asked to do is create a button that will allow the user to print the contents of the main window (main frame) without the navigation bar (header...
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 language="javascript"> var len = 0; var i = 0; var t; function printAll(){ len = document.frames.length; for(var i=0;i<len;i++){ frames.focus();
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.