View Full Version : get all images in a specified table

07-15-2009, 01:41 AM
I found this on the other site and I'm just gonna kinda copy & paste...

<table id ="this" >
<td><img /></td>
<td><img /></td>
<td><img /></td>
<td><img /></td>

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.

Old Pedant
07-15-2009, 03:23 AM
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.

07-15-2009, 07:10 AM
Ah stupid me for such a simple question...