Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-15-2009, 12:41 AM   PM User | #1
MrAtheist
New Coder

 
Join Date: Apr 2009
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
MrAtheist is an unknown quantity at this point
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.
MrAtheist is offline   Reply With Quote
Old 07-15-2009, 02:23 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,999 Times in 3,968 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 07-15-2009, 06:10 AM   PM User | #3
MrAtheist
New Coder

 
Join Date: Apr 2009
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
MrAtheist is an unknown quantity at this point
Ah stupid me for such a simple question...

Thanks
MrAtheist is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:57 PM.


Advertisement
Log in to turn off these ads.