Hi
I have a listbox and I am using javascript to fill in the values. I have a function which takes an array as input and is supposed to put them inside the drop-down listbox.
I donno how to add the <option> and </option> html tags while I am using javascript.
Here is the code I have:
<select name="select2">
<script type="text/javascript">
function cArray(x)
{
for (loop5 = 0; loop5 < x.length; loop5++){
// I can't use <option> and </option> in here
// cause I am in middle of javascript
// I can't use it outside of script either because
// number of options depend on number of values in
// the array
<option> x[loop5]</option>
}
}
</script>
</select>
Thanks for your help
I have a listbox and I am using javascript to fill in the values. I have a function which takes an array as input and is supposed to put them inside the drop-down listbox.
I donno how to add the <option> and </option> html tags while I am using javascript.
Here is the code I have:
<select name="select2">
<script type="text/javascript">
function cArray(x)
{
for (loop5 = 0; loop5 < x.length; loop5++){
// I can't use <option> and </option> in here
// cause I am in middle of javascript
// I can't use it outside of script either because
// number of options depend on number of values in
// the array
<option> x[loop5]</option>
}
}
</script>
</select>
Thanks for your help