By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,213 Members | 2,108 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,213 IT Pros & Developers. It's quick & easy.

document.body.style.zoom

P: n/a
I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried
document.body.style.fontSize='50%' for example, on an onclick() event,
but it did not work.

I tried zooming with the following code, and it works:

<td valign="baseline"><a href="#" onclick="(document.body.style.zoom)?
document.body.style.zoom/=1.2:document.body.style.zoom=1/1.2">A-
&nbsp;</a></td>

<td valign="baseline"><a href="#"
onclick="document.body.style.zoom=1">A&nbsp;</a></td>

<td valign="baseline"><a href="#" onclick="(document.body.style.zoom)?
document.body.style.zoom*=1.2:document.body.style. zoom=1.2">A+</a></
td>

But, I have a question. This is zooming the text on the page we are
on. But, when we go to another page on the site, this is not carried
forward (the zoom factor). Is there a way to do that?

Also, is there a way to not zoom the left and top navigation bars, but
just zoom the content page?

Thanks in advance for any suggestions,
jnag

Jun 1 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Jun 1, 11:50 am, jnag <prajy...@gmail.comwrote:
I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried
document.body.style.fontSize='50%' for example, on an onclick() event,
but it did not work.
Why didn't that work? It should. Is the font size in you CSS cascade
blocking this from working?

Peter

Jun 5 '07 #2

P: n/a
On Jun 5, 6:23 pm, Peter Michaux <petermich...@gmail.comwrote:
On Jun 1, 11:50 am,jnag<prajy...@gmail.comwrote:
I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried
document.body.style.fontSize='50%' for example, on an onclick() event,
but it did not work.

Why didn't that work? It should. Is the font size in you CSS cascade
blocking this from working?

Peter
Yes, I think the font size in the CSS is preventing this from working.
But, I am not sure how to fix it.
Thanks.

Jun 6 '07 #3

P: n/a
On Jun 6, 12:26 pm, jnag <prajy...@gmail.comwrote:
On Jun 5, 6:23 pm, Peter Michaux <petermich...@gmail.comwrote:
On Jun 1, 11:50 am,jnag<prajy...@gmail.comwrote:
I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried
document.body.style.fontSize='50%' for example, on an onclick() event,
but it did not work.
Why didn't that work? It should. Is the font size in you CSS cascade
blocking this from working?
Peter

Yes, I think the font size in the CSS is preventing this from working.
But, I am not sure how to fix it.
If it is a CSS cascade issue then look into CSS cascade rules and how
the CSS selectors vary in priority. I think that would be the safest
thing to do. Trying to fix this with JavaScript is hacking for sure.
If you use the Firefox Firebug plugin you can easily see which rules
are being blocked by other rules in the cascade.

Peter

Jun 6 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.