• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing a array in javascript

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a variable strarray in my form which is an array of Strings (String[])
I have this variable declared as hidden in my jsp.
The values in strarray = {"dog", "cat", rat"}- for example.
In the javascript, I am trying to access the variable as
document.forms[0].strarray[0].value.
This is giving an error on page saying that strarray.0.value is null or not an object.
However, when I print this variable in my action , it does print out the right values.
Not sure what I am missing here. Any help will be appreciated.
Thanks.
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you ever use this.

May be It's can display your value..
:roll: I don't sure it's work for you but just try. if you found any solution tell me too.
 
reply
    Bookmark Topic Watch Topic
  • New Topic