document.body.style.fontsize is not working

J

jnag

Hello,

Through an onClick() event, I have an inline function to change the
font size of the page (actually, I need to do this for the entire
website). I have this defined in the header.cfm file as:

onclick="document.body.style.fontSize='50%';"

This does not work at all for some reason. Whereas,

onclick="document.body.style.backgroundColor='green';"

works. I am not able to understand why this is happening.

Any help is greatly appreciated.

Thanks,
jnag
 
G

Georgi Naumov

This code working for me.
onclick="document.body.style.fontSize='50%';"
(FF2 and IE6) . You can try something like this:
onclick="try{document.body.style.fontSize='50%';}catch(ex)
{alert(ex.message);}"
To see what is problem.

jnag :
 
P

Pete

onclick="document.body.style.fontSize='50%';"

This does not work at all for some reason. Whereas,

<a href="#" onclick="document.body.style.fontSize='50%';return
false;">link</a>

this works fine.

how are you calling onclick?
 
J

jnag

<a href="#" onclick="document.body.style.fontSize='50%';return
false;">link</a>

this works fine.

how are you calling onclick?

I am calling onclick in a header.cfm file. And, I want to change the
font of the <body> of the content pages which are outside the header/
banner. The error message I am getting says that it cannot find the
object to change font.
 
J

jnag

<a href="#" onclick="document.body.style.fontSize='50%';return
false;">link</a>

this works fine.

how are you calling onclick?

Actually, now I am not getting any error message. But, the fontSize
does not change either upong clicking the link/button in the banner.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top