Page 1 of 1

getElementById

Posted: Wed Feb 23, 2005 6:07 pm
by xudzh
I have a <form> <input type=submit name=aaa id=aaa value=submit></form>.

In IE address bar, when i type

Code: Select all

getElementById('aaa').style.visibility='hidden'; alert(forms&#1111;0].aaa.style.visibility);
i get an empty alert box (empty string).

if i do

Code: Select all

forms&#1111;0].aaa.style.visibility="hidden";
and then alert i get "hidden".

Is this normal?

Posted: Wed Feb 23, 2005 6:12 pm
by feyd
and element's id has nothing to do with its name. forums[0].aaa is an object's name.

Posted: Wed Feb 23, 2005 6:32 pm
by xudzh
What :?: :?: :?: :?: :?: :?: :?: :?:

Posted: Wed Feb 23, 2005 6:35 pm
by xudzh
I mean that if i use getElementById as a reference to modify it its style.visibility returens "".
If i use forms[0].aaa to modify than visibility returns hidden.

Posted: Wed Feb 23, 2005 6:52 pm
by feyd
it appears you edited your original post after I first read it and before I finished replying..

anyway, getElementById() is not available outside a document object... thus:

Code: Select all

document.getElementById('aaa').style.visibility='hidden'; alert(forms&#1111;0].aaa.style.visibility);