• 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

JAVA SCRIPT

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HOW DO I POPULATE AN HTML LISTBOX DYNAMICALLY USING JAVA SCRIPT?
I'VE TRIED USING ADD METHOD BUT FAILED. KINDLY LET ME KNOW AS TO HOW TO GO ABOUT WITH IT.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
Where are you going to get the options to populate the list with? What type of page is this? Is this script server-side or client-side?
Without more information it's a bit difficult to help you. Anyway here's a basic scenario that might help you:
The basic idea would be to assign values to the list box at page construction time, so you will need to have your list of retrievable values at that time.
Lets imagine you have your values in an object called 'values' (could be an array, a collection,...) and another object that contains the names corresponding to those values called 'names'
Then simply use a for loop like this:

Hope that helps,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
BISWAS RAHUL
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using client side scripting

Originally posted by BISWAS RAHUL:
HOW DO I POPULATE AN HTML LISTBOX DYNAMICALLY USING JAVA SCRIPT?
I'VE TRIED USING ADD METHOD BUT FAILED. KINDLY LET ME KNOW AS TO HOW TO GO ABOUT WITH IT.


 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then let's move it to the client side forum...

 
I'm so happy! And I wish to make this tiny ad happy too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic