getElementById

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
xudzh
Forum Commoner
Posts: 48
Joined: Sat Feb 19, 2005 6:22 pm

getElementById

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

and element's id has nothing to do with its name. forums[0].aaa is an object's name.
xudzh
Forum Commoner
Posts: 48
Joined: Sat Feb 19, 2005 6:22 pm

Post by xudzh »

What :?: :?: :?: :?: :?: :?: :?: :?:
xudzh
Forum Commoner
Posts: 48
Joined: Sat Feb 19, 2005 6:22 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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);
Post Reply