/    Sign up×
Community /Pin to ProfileBookmark

How to print Frame content from another frame

I have this help pages, which is divided into three frames, First one for tool bar buttons, the second on the left for index or table of content, the third frame is for content body and data.

I want to activate the print button from the tool bar, but i need to know which frame is loaded at the moment, as the content in third frame is dynamically loaded depending on your choice.

So how to achieve this, how to get the frame name in order to use framename.focus and framename.print.

Thank you in advance ?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 14.2008 — I think you are confusing FRAME (a window object) with what is loaded in the frame (a document).

If you always want to print the content frame, you use its name.
window.top.frameName.print()Fill in the correct frameName.
Copy linkTweet thisAlerts:
@hmasamraauthorJan 14.2008 — Thank you gil davis;

I knew that, but really document is formed using JavaScript, each time, <frameset> is formed, <frame> tag has a different name, do you know any way to get which frame is loaded at the moment, otherwise i'm going to try each and every frame name i could get from the code and what's going to print.

Thanks
Copy linkTweet thisAlerts:
@gil_davisJan 14.2008 — In that case, you have made a poor design decision. ?

The page with the print button needs to know what the name is. Something must remain constant for that to happen. You cannot guess at the names. You will have all sorts of errors on the client.

If you feel it is essential to have the frame name change for each page, then you will have to make a global variable in the <frameset> so that all pages can access it. Then the page that can be printed would have to have a script to put its name in that variable at onload time.
×

Success!

Help @hmasamra spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...