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 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2003
    Location
    Sasolburg, South Africa
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using getElementBiId to change the text on a button to bold

    Hi Everyone,

    I am using the following code in a function to change the background and the text color of a button:

    function indicateShortTrade() {
    document.getElementById("btShort").style.backgroundColor="#FF0000";
    document.getElementById("btShort").style.color="#FFFFFF";
    window.focus()
    }

    The problem is that I am also trying to change the font to bold.
    None of the properties I tried - or shall I say invented - worked. I tried ("btShort").fontweight="bold"; "btShort").style.text="bold" and various others, but the text stays normal.

    If you know the correct code please let me know. And..., I nearly forgot, how to change back from "bold" to "normal" again.

    Thanks,
    Dieter

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #3
    New Coder
    Join Date
    Nov 2003
    Location
    Sasolburg, South Africa
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Fred,

    I can't believe it. The "W" vs "w" in fontWeight makes all the difference. Just as a test I changed "backgroundColor" to "backgroundcolor" and found that it would not work. I guess this proves that JS is case sensitive. Problem solved. Thanks.

  • #4
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This was posted in the wrong forum. I believe that according to the rules for this forum, it should be deleted.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #5
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by Skyzyx
    This was posted in the wrong forum. I believe that according to the rules for this forum, it should be deleted.
    I'll just move it instead...

  • #6
    New Coder
    Join Date
    Nov 2003
    Location
    Sasolburg, South Africa
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks jkd,

    When I realised my mistake it was already too late. My next post is in the correct section.

    Dieter



  •  

    Posting Permissions

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