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

Problem setting font size

P: 57
hello
i need help about getElementById(id) function

function setFontSize(size) {
document.getElementById('fontsize').style.fontSize = size;
}

is my function

it isn't showing
i think i used first ID inside of second ID

the 'fontsize' is inside of 'opentable'
1st version:
[HTML]
<a href='#' onclick="setFontSize(15)">15</a>
<table id='opentable'><tr><td><div id='fontsize'>Hello</div></td></tr></table>[/HTML]
2nd version
[HTML]<a href='#' onclick="setFontSize(15)">15</a>
<table id='opentable'><tr><td id='fontsize'>Hello</td></tr></table>[/HTML]



it doesn't change
Nov 27 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 173
hello
i need help about getElementById(id) function

function setFontSize(size) {
document.getElementById('fontsize').style.fontSize = size;
}

is my function

it isn't showing
i think i used first ID inside of second ID

the 'fontsize' is inside of 'opentable'
1st version:
[HTML]
<a href='#' onclick="setFontSize(15)">15</a>
<table id='opentable'><tr><td><div id='fontsize'>Hello</div></td></tr></table>[/HTML]
2nd version
[HTML]<a href='#' onclick="setFontSize(15)">15</a>
<table id='opentable'><tr><td id='fontsize'>Hello</td></tr></table>[/HTML]



it doesn't change
Hi,

Try putting a unit after the size number e.g. 15px, 15em...
Nov 27 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

MODERATOR
Nov 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.