getElementsByName question

wxdqz

New Member
I have <img> tag like this :

<img name="thumb1" src=http://www.webdeveloper.com/forum/archive/index.php/"test.gif" border=0></img>

Why I can not get that object by using getElementsByName?

I tried this way :

var obj = document.getElementsByName("thumb1");
obj.src = "newpic.gif";

But, I can do it like this :

var obj = document.all["thumb1"];
obj.src = "newpic.gif";

So, when should we use getElementsByName ?

I use MSIE 6.0 and Dreamweaver MX.

Please enlighten me :)

Thanks.
 
Back
Top