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 4 of 4
  1. #1
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Question simple getDocumentbyID question

    I have a table in which i need certain cells to have a certain background image. I figured the the best way to do this would be as follows:

    unfortunantly this code is syntactically incorrect. what is the right syntax?
    Code:
    document.getElementById("backgroundCells").background = 'images/t28_17.gif';
    also, i need to apply this to multiple cells on one page, so it cant be document.getElementById is has to be document.getElementByClass.

    can i even do this?
    Last edited by canadianjameson; 12-10-2004 at 06:10 PM.
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    If they all have the same bg image then just give them a class and assign the bg image with css. If there are multiple images make multiple classes, or give each a unique ID if they are all different bgs. Unless you want to change the bg on the fly I don't really see the need for the JS.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    good thinking

    so i do this:

    Code:
    .cellBG 
    { baground-image: images/t28_17.gif }
    ?
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #4
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    got it

    Code:
    <style type="text/css">
    .cellBG 
    { background-image: url('images/t28_17.gif') }
    </style>
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)


  •  

    Posting Permissions

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