PDA

View Full Version : How to use TEXT SIZER on a web page containing frames?



student
10-15-2009, 08:23 AM
1) Script Title: Text Sizer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/textsizer.htm

3) Describe problem: Hi! I am designing a webpage with Frames
(mainFrame + bottom frame). The actual text is mostly in the
mainFrame of my page. I wish to place the text-sizer control (<a href="javascript:ts('body',1)"> + Larger Font</a> | <a href="javascript:ts('body',-1)">+ Smaller Font</a>) in the
bottom Frame. Can you please tell me how I can use your script
textsizer.js for re-sizing the text in the mainFrame?
I want the text-sizer "target" to be the "mainFrame".
Thanks in advance.

jscheuer1
10-15-2009, 08:50 AM
Generally what you do in a case like that is to put the script on the page in the mainFrame.

Now frames on a page are counted from 0 to however many there are, or you can use their names (if they have names) to access them as well. The frameset page is the parent of the pages in its frames.

So to access the script on the page in the mainFrame, you could put something like this on a page in the other frame:


<a href="#" onclick="parent.frames[0].ts('body',1); return false;"> + Larger Font</a> | <a href="#" onclick="parent.frames[0].ts('body',-1); return false;">+ Smaller Font</a>

One caveat though, all three pages (frameset, main, and bottom) must be on the same domain.

student
10-15-2009, 09:23 AM
Hi jscheuer1! Thanks a ton! Yeah, it works fine
in fireFox 3.0.14, IE 8 & NetScape 9 too!
Yippeeeeeeeeeeee! :)