this is not a perl question.  better posted to a HTML/javascript list.

nonetheless the following works ...


<form>
<select name="category" onclick="updateSubCategory(this.value);">
        <option value=""></option>
        <option value="A">A</option>
        <option value="B">B</option>
</select>

<select name="sub-category">
</select>
</form>

<script language="javascript">
        
function updateSubCategory(sCategory)
{
        var aSubCategories = new Array('A1','A2','B1','B2');
        var oForm = document.forms[0];
        var oSubCategory = oForm.elements['sub-category'];
        var oNewOption;
        var i;  

        while (oSubCategory.options.length != 0)
        {
                oSubCategory.options[0] = null;
        }
        
        for (i=0; i<aSubCategories.length; i++)
        {
                if (aSubCategories[i].substr(0,1) == sCategory)
                {
                        oNewOption = new Option(aSubCategories[i],
aSubCategories[i]);
                        oSubCategory.options[oSubCategory.length] =
oNewOption;
                }
        }
}
</script>




> -----Original Message-----
> From: Mariusz [mailto:mkubis22@;hotmail.com]
> Sent: Wednesday, November 06, 2002 1:56 PM
> To: perl
> Subject: javascript anybody?
> 
> 
> I think my problem should be rather solved in JavaScript, but 
> where can I find help? I tried many different keywords on 
> goggle to find some info on accomplishing the following (but 
> without success):
> 
> I have two pull-down menus. How can I make the values 
> (choices) in the second pull-down menu depend on the choice 
> from the first one? E.g.
> pull-down1 "category"        (choices: A,B,C..)
> pull-down2 "subcategory"   (if choice A was selected in 1, 
> then choices in 2 are for example A1, A2, etc..)
> 
> any help greatly appreciated
> Mariusz
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to