www.webdeveloper.com
Results 1 to 3 of 3

Thread: IF statment and drop box

  1. #1
    Join Date
    Dec 2011
    Posts
    79

    IF statment and drop box

    Hi, I want the drop box to change demendant on the passeddata value, but this wont work, any help

    Code:
    function car() {
    
    passedData = urlGet();
    
    document.date.lpag.value = passedData['car'];
    var lala = document.date.lpag.value
    if (lala == "G" ) { document.date.car.options[document.date.car.selectedIndex].value= "G" }
    }

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    You may have to run a loop to find when car.options.value=='G'
    then, car.selectedIndex=i

  3. #3
    Join Date
    Mar 2012
    Posts
    202
    Quote Originally Posted by chrisboots View Post
    document.date.car.options[document.date.car.selectedIndex].value
    i think you are trying to use options (an array variable) as an object of the "car" element. this won't work as it is logically incorrect. if the list box element can be directly accessed (i'm assuming it's document.date.car) then document.date.car.value can be set to the value of the option element and the value of the listbox will change accordingly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles