CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   DOM and JSON scripting (http://www.codingforums.com/forumdisplay.php?f=15)
-   -   want to have alert() send current fontSize value of a specified element (http://www.codingforums.com/showthread.php?t=36337)

coder_seth 04-06-2004 04:37 AM

want to have alert() send current fontSize value of a specified element
 
Code:

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.


All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.