wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes argument in form access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "argument in form access" Watch "argument in form access" New topic
Author

argument in form access

Michael McNally
Ranch Hand

Joined: Aug 22, 2002
Posts: 53
I have created a form(controlForm) with a table inside. some of the table elements have names. I have created a function that will toggle the display of all elements with that name. here it is:

Why doesn't this argument work in object access? I have also tried this function and still it doesn't work. All help is welcomed. thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

document.getElementsByName returns a collection, not a singleton element.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michael McNally
Ranch Hand

Joined: Aug 22, 2002
Posts: 53
i see. so in order to use the document.getElementsByName with a single argument, that single argument would need to be an array element such as name[0].
Either way, after 2 hours of rethinking this equation, it all seems to be very simple...

This script effectively toggles the display of up to four objects(in this case: table rows) when invoked with the onclick handler of the top row that controls them. like this:

Great way to make a control panel or menu.
[ July 12, 2003: Message edited by: Michael McNally ]
Michael McNally
Ranch Hand

Joined: Aug 22, 2002
Posts: 53
I just made an even larger improvement
Michael McNally
Ranch Hand

Joined: Aug 22, 2002
Posts: 53
Perfect Form! Toggles the display of all listed arguments without any flaws.
 
 
subject: argument in form access
 
Similar Threads
how to hide html element underneath?
Problem in form submitting.
URGENT Help needed on JavaScript.
Recieving 'null' values from a jsp page in Struts2 Action
Page section does not update after call of a4j:support in IE 9