【发布时间】:2013-02-20 06:44:46
【问题描述】:
您好,想知道您是否可以提供帮助,当用户指定他们的性别类型时,我需要使用 JavaScript 在衣服选项框中填充适当的选项。这是我到目前为止的代码,
<script type="text/javascript">
var subListArray = [];
subListArray[0] = 'Select a type first';
subListArray[1] = ['skirt', 'dress', 'tights'];
subListArray[2] = ['jeans', 'hat'];
</script>
人
Gender Type: <select name="genderType" id="genderType" >
<option value="">Gender Type?</option>
<option value="girl">Female</option>
<option value="boy">Male</option>
</select> </br>
Clothes <select name="clothType">
<option value="">Choose a Type</option>
</select>
【问题讨论】:
-
你如何将性别与特定的数组联系起来?
-
你是不是建议男人不要穿tights? :P
-
@Jason:Cary Elwes 让它看起来不错,这是真的。
-
我不知道如何将性别与特定数组联系起来,我只是想要它,所以当您选择性别类型的女孩时,“裙子”、“连衣裙”、“紧身衣”会出现在选项值中在衣服上。
标签: javascript arrays option