Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts

    Select box error

    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.

    Code:
    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');">

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    i<mydd.options.length
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Good eye, that improved my code.

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •