Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help me with this problem..

 
shah rah
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



onclick of button I want the textbox value associated with that button.
if button[0] is clicked I want the hid_text[0].value
if button[1] is clicked I want the hid_text[1].value

how to get the corresponding value?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you have a form element with a name that includes JavaScript-sensitive characters such as periods and square brackets, you can't use the usual JavaScript notation of "document.myForm.myInput". However, with JavaScript there's always more than one way to do things, so you just have to get a little creative about how to access the object. One way would be to use the getElementsByName method. This method always returns an array, even if there's only one element with that name. Therefore, something like the following would work:

[ March 23, 2007: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic