File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes DOM and adding a brand new select list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DOM and adding a brand new select list" Watch "DOM and adding a brand new select list" New topic
Author

DOM and adding a brand new select list

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
Can anyone tell me or show me how I can dynamically add a new row to a table and in one of the newly added cells add a brand new select list? The cells I'm adding using DOM are fine but when I try putting in the select list it doesn't work. For example, if I try and set the cell's innerText it just displays the tag for the select list. If I try and set the innerHtml it gives me nothing. Any help would be appreciated. Thanks.

Rob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Where's your code?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
with a select you should be use new Option()



Eric
binayakumar patel
Greenhorn

Joined: Jun 26, 2009
Posts: 27
This may Help you.
binayakumar patel
Greenhorn

Joined: Jun 26, 2009
Posts: 27
Inplace of

# var option1 = document.createElement("OPTION")
# option1.text="Banana"
# option1.value=1
# selectBox.options.add(option1)

We can use:

selectBox.options[selectBox.options.length]=new Option("Banana","1")
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DOM and adding a brand new select list