Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Banned
    Join Date
    Jan 2004
    Location
    Minneapolis, MN
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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")
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Banned
    Join Date
    Jan 2004
    Location
    Minneapolis, MN
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ah, okay. thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •