Illustrates how to add OPTIONS to a SELECT using client-side JavaScript
Feel the need to add to the options that are available in a <SELECT> tag from the browser? The code below contains an illustration of the basic technique.
Dim anOption
Set anOption = document.createElement("OPTION")
document.form1.select1.options.add anOption
anOption.innerText = "Two"
anOption.Value = "2"
Want to do the same thing, but in JavaScript. Try the following
var anOption = document.createElement("OPTION")
document.form1.select1.options.add(anOption)
anOption.innerText = "Two"
anOption.Value = "2"
Almost too easy, isn't it.
Comments