1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

problem displaying the options in selectbox while creating it dynamically in opera9.2

Discussion in 'JavaScript and AJAX' started by ramchml, Oct 12, 2007.

  1. ramchml

    ramchml New Member

    Joined:
    Oct 12, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    i have two select boxes based on the selected value in one select box it should display the maximum options in the other select box.
    i used javascript onClick for the first time it displays correct values again when i go back and change the value in the 1st selectbox the 2nd select box display previous values only.it works in all the browsers except opera.
    my code is
    Code:
    function CalBasedMaxVal(selVal,changedVal,maxiVal,DefVal)
    {
    var CalBasedSelValue=selVal.selectedIndex+1;
    var defaultText = '-['+lang_text_ary['default']+']';
    var optionName;
    while (changedVal.options.length)
    {
    changedVal.remove(0);
    changedVal.options[0] = null;
    }
    for (var i=1; i<=maxiVal; i++)
    {
    if(i==DefVal)
    {
    optionName = new Option(i+defaultText, i, false, true);
    }
    else
    {
    optionName = new Option(i, i, false, false);
    }
    changedVal.options[changedVal.length] = optionName;
    }
    }
     
    Last edited by a moderator: Oct 12, 2007
  2. Rexy93

    Rexy93 New Member

    Joined:
    Oct 26, 2007
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Web Designer and completing year 9
    Location:
    Australia
    I honestly can't help you witth this one as I don't see a problem in the coding. Maybe if you update to the latest Opera it should work because different browsers show things differently.

    Just try to update Opera.
     

Share This Page