...

View Full Version : Select box error



arnyinc
01-28-2005, 04:07 PM
I can't figure out why my function gives me an error. The function works, but it also gives me the error "Could not set the selected property. Unspecified error". If it makes any different, I only get the error in IE never in Firefox.



function setDropdown(mydd, defaultValue){
for (var i=0; i<mydd.length; i++)
if (mydd.options[i].value==defaultValue)
mydd.options[i].selected=true; //this is the line with the error
}


I call it when I load the page:
<body onload="setDropdown(myform.filterowner, '11');">

I've also tried:
<body onload="setDropdown(document.myform.filterowner, '11');">

Kor
01-28-2005, 04:35 PM
i<mydd.options.length

arnyinc
01-28-2005, 05:19 PM
Good eye, that improved my code.

For some reason, I still get the same error though.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum