Closed Thread Icon

Topic awaiting preservation: javascript help.. (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8158" title="Pages that link to Topic awaiting preservation: javascript help.. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: javascript help.. <span class="small">(Page 1 of 1)</span>\

 
maestro
Nervous Wreck (II) Inmate

From: Somewhere out there
Insane since: Oct 2001

posted posted 05-06-2002 03:01

hi, my html page has an iframe and i would like to have a button on the html page that will increase the font size of the text in the iframe. is that possible? can the javascript be targetted to that iframe? if so, hope you guys can help me out here abit.. thanks a lot!

evo.lanche - evolve. the only constant in life.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-06-2002 05:06

maestro: Try this:

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
function changeFontsize(increment) {

var getElement = document.getElementsByTagName("p");

for (var i=0; i<getElement.length; i++) {
var eachElement = getElement[i];

if (document.defaultView) {
var currentFontSize = document.defaultView.getComputedStyle(eachElement, null).getPropertyValue(fontSize);
}
else if (eachElement.currentStyle) {
var currentFontSize = eachElement.currentStyle.fontSize;
}

var currFontSize = parseInt(currentFontSize, 10);

var fontIncrease = parseInt(increment, 10);

if (increment>0

maestro
Nervous Wreck (II) Inmate

From: Somewhere out there
Insane since: Oct 2001

posted posted 05-06-2002 09:37

hi emperor, thanks for the help. i know the script for changing the font size but what if the text that i want the font size changed, is in an iframe? can i use the 'target' within the <a> tag?

what i mean is that the button resides on the main html but i want the user to click this button and it changes the font size of the text IN the iframe...


evo.lanche - evolve. the only constant in life.

[This message has been edited by maestro (edited 05-06-2002).]

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-06-2002 13:52

maestro: Well I hate frames and try to avoid them where I can - I'd try changing 'document' in the above code to something like parent.FRAMENAME I believe that should work (if not someone will jump in with the correct solution ).

Emps

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-07-2002 07:50

Emperor is right, just change document.getElementsByTagName("p") to something like parent.frames["frameName"].document.getElementsByTagName("p") and everything will be fine.

BTW File that is loaded in IFRAME must be on the same domain as the calling page, or you'll get "access denied" error message (web browsers don't allow changing pages that are not on the same domain).


« BackwardsOnwards »

Show Forum Drop Down Menu