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
    New Coder
    Join Date
    Apr 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    get all images in a specified table

    I found this on the other site and I'm just gonna kinda copy & paste...

    Code:
    <table id ="this" >
       <tr>
            <td><img /></td>
    <td><img /></td>
    <td><img /></td>
    <td><img /></td>
       </tr>
    </table>
    I'm looking for a js function to return all the imgs in that table. Then I'm gonna do setattribute('src',.....)

    Any input would be great.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,565
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    var imagesInThis = document.getElementById("this").getElementsByTagName("IMG");

    But using the name "this" is a rotten idea, because it's apt to be confused with the JavaScript keyword this.

  • #3
    New Coder
    Join Date
    Apr 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Ah stupid me for such a simple question...

    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
    •