Hi,
Is there anything wrong with this code or does new Option just not work
very well.
I have a select box on my form:
<select name="FirstLine" size="5" style="width:122px;">
</select>
and I have a form element:
<form METHOD="post" ACTION="Scale_New.asp" id="Scale_New"
name="Scale_New">
I'm trying to do something a little more complex but for the sake of
just getting this to work..I've simplified it and this doesn't work
either.
I have a button that calls a javascript function that adds "options" to
the select box.
<button name="FirstLine" onclick="Add1();">Add First Line</button>
and here's my javascript function:
function Add1()
{
document.Scale_New.FirstLine.options[0] = new Option('new text', 'new
value');
}
and I get an error "document.Scale_New.FirstLine.options is null or not
an object"
I've tried changing it to document.forms[0] and changing the options to
options[1] or even options[document.Scale_New.FirstLine.options.length]
and that doesn't work either.
Does anyone see anything wrong here?
I'm using IE 6.
Thanks
Rob
*** Sent via Developersdex http://www.developersdex.com ***