Link to home
Start Free TrialLog in
Avatar of Turfimage
TurfimageFlag for United States of America

asked on

Iframe Font Size Change

You know how a user can change the size of the fonts on an html page by using (+/-)? I want to do this on three iframes at the same time. I can do it on the main page and it works but the iframe (2) stay the same size. I don’t want to make all three have their own (+/-). Anyway to make all of them change with one button?
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Not going to happen.  The frames are each seperate logical windows.  you can only be focus on one window at a time.  Keyboard and other device input can only be applied to the window that currently has focus.

In theory you could fire a function on one iframe to cause a change on another iframe, but the scripting runs into security restrictions unless the pages are all served from the same domain; in which case it gets ignored. You would also never want to use the keyboard for such an action because that is just about the least reliable way to do it.

Cd&
Avatar of Turfimage

ASKER

Yes. all pages are on same domain. Is there a way to tie all three to one function? I got it to work on one but the buttom had to be within that iframe. Im looking to make all three change with one button at the sametime. thx
It is going to be a lot of work and there is no quarantee it will work cross-browser.  T start I need a link to the page so I can see structure, and whether the code is close enough to standard to give us a chance of getting it to work.

Cd&
OK. so I made each frame have its own (+/-) button and it seems to be ok.... but Im using this

<script language="JavaScript" type="text/javascript">function changeFontSize(inc){  var p = document.getElementsByTagName('p');  for(n=0; n<p.length; n++) {    if(p[n].style.fontSize) {       var size = parseInt(p[n].style.fontSize.replace("px", ""));    } else {       var size = 11;    }    p[n].style.fontSize = size+inc + 'px';   }}</script>

Now only the words that have <p> ... <p/> around them change? also the CSS for the headers resize to a smaller size so it looks sort of strange. Is there a better way? thx
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is there a way to make a button to do Crtl (+) or Crtl (-) ? Like a normal webbrowser but from the webpage itself?