| Author |
how to get image input element on a form in Netscape?
|
lily zou
Ranch Hand
Joined: Jan 15, 2002
Posts: 50
|
|
I have a form and there is element on it like: <input type="image" name="ABC" src="/ABC" alt="A"/> In javascript, I could use document.getElementById("ABC") to get this element and do things to it when I use Explorer . However, I cann't access it when I use Netscape by any means. I used document.froms[0] to iterate but could not find it, neither when I use document.images. Is there any one who knows why and how ? Thanks in advance, Lily
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
document.FormName.ElementName.src="blah" document.forms[0].ElementName.src="blah"
|
 |
lily zou
Ranch Hand
Joined: Jan 15, 2002
Posts: 50
|
|
|
Thanks Eric but I tried that already. It backs me message "undefinied ".
|
 |
Bear Bibeault
Author and opinionated walrus
Marshal
Joined: Jan 10, 2002
Posts: 50677
|
|
Assuming that when you say "Netscape" you are talking about a modern version, be sure to put the id="elementName" attribute on the element you are trying to fetch with getElementById. IE allows you to reference the element by its "name" attribute when using getElementbyId, but it shouldn't. Name and id are not the same. hth, bear
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: how to get image input element on a form in Netscape?
|
|
|