Click to See Complete Forum and Search --> : 'Options' is null or not an object


TennesseeDude
10-28-2003, 10:07 PM
Can anyone take a peak at the code below and perhaps break it down to me in non programming lingo of what it is I am doing wrong in the script? I have been through tutorials galore but am unable to still find a solution that works. Here is all the affected code I am using:

<script language="JavaScript" type="text/javascript">

function doit(selObj, selVal)
{
if (selVal == 'more' || selVal == 'less')
{
if (selVal == 'more')
fillSel(selObj, xtraRates)
else
fillSel(selObj, orgRates)
}
else
{
document.orderfm.total_4.value = selVal;
UpdateTotals()
}
}

function fillSel(selObj, arrayObj)
{
var orgRates = [ ["$8.00", "$0.01 to $100.00"], ["$8.85", "$100.01 to $500.00"], ["$9.70", "$501.00 to $1,000.00"], ["$10.55", "$1,000.01 to $2,000.00"], ["$11.40", "$2,000.01 to $3,000.00"], ["$12.25", "$3,000.01 to $4,000.00"], ["$13.10", "$4,000.01 to $5,000.00"], ["$13.95", "$5,000.01 to $6,000.00"], ["$14.80", "$6,000.01 to $7,000.00"], ["$15.65", "$7,000.01 to $8,000.00"], ["$16.50", "$8,000.01 to $9,000.00"], ["$17.35", "$9,000.00 to $10,000.00"], ['more','more'] ];
var xtraRates = [ ["less", "less"], ["10,000.01 to $11,000.00", "$18.20"], ["$11,000.01 to $12,000.00", "$19.05"], ["$12,000.01 to $13,000.00", "$19.90"], ["$13,000.01 to $14,000.00", "$20.75"], ["$14,000.01 to $15,000.00", "$21.60"], ["$15,000.01 to $16,000.00", "$22.45"], ["$16,000.01 to $17,000.00", "$23.30"], ["$17,000.01 to $18,000.00", "$24.15"], ["$18,000.01 to $19,000.00", "$25.00"], ["$19,000.01 to $20,000.00", "$25.85"], ["$20,000.01 to $21,000.00", "$26.70"], ["$21,000.01 to $22,000.00", "$27.55"], ["$22,000.01 to $23,000.00", "$28.40"], ["$23,000.01 to $24,000.00", "$29.25"], ["$24,000.01 to $25,000.00", "$30.10"] ];
selObj.options.length=0;
for (i = 0; i < arrayObj.length; i++)
selObj.options[selObj.length] = new Option(arrayObj[i][0], arrayObj[i][1])

}</script>

onLoad="fillSel('document.orderfm.uspsField, orgRates')"

<select name="uspsField" onChange="doit(this, this.options[this.selectedIndex].value)">
<option>USPS Insurance Rates</option>
</select>

agminer
10-28-2003, 10:51 PM
onLoad="fillSel('document.orderfm.uspsField', 'orgRates')"

Try inserting the red quote marks.

TennesseeDude
10-29-2003, 07:43 AM
I tried to add the 2 extra quote marks but I still get the same error message. Perhaps with a fresh pair of eyes I can figure out what the problem is. Thanks for the help.