...

View Full Version : want to have alert() send current fontSize value of a specified element



coder_seth
04-06-2004, 04:37 AM
alert(string(document.getElementById("body").style.fontSize));


my alerts are blank.

not sure what i am missing.

Kor
04-06-2004, 01:07 PM
1.to use that method you must have had that style inside the tag (or pre set up on-the-fly by a javascript function), not as an external CSS code.

<div id="body" style="font-size:20px">text</div>

2. If you have an embedded or external code, the syntax is otherwise

for IE
document.getElementById("body").currentStyle.fontSize
for Mozilla
document.defaultView.getComputedStyle(document.getElementById("body"),'').getPropertyValue("font-size")

coder_seth
04-06-2004, 03:01 PM
ah, okay. thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum