在下拉单击时更改内容

时间:2013-08-16 21:11:15

标签: html drop-down-menu paypal

我正在尝试用2个下拉菜单制作一个贝宝项目。我想在第一个下拉菜单根据选择更改第二个菜单的位置。我该怎么做呢?我尝试在第一个菜单上使用带有onchange的javascript,为第二个菜单使用.innerHtml。

<tr><td><input type="hidden" name="on0" value="Year">Year</td></tr><tr><td><select name="os0">
<option value="None">None </option><!-- Show list 1 -->
<option value="2015">2015 </option><!-- replace list 1 with list 2  -->
<option value="2016">2016 </option><!-- replace list 1 with list 2 -->
<option value="2017">2017 </option><!-- replace list 1 with list 2 -->
</select> </td></tr>


<tr><td><input type="hidden" name="on1" value="Size">Size</td></tr><tr><td><select name="os1">
<!-- List 1 -->
<option value="Youth X-Small">Youth X-Small </option>
<option value="Youth Medium">Youth Medium </option>
<option value="Youth Large">Youth Large </option>
<option value="Youth X-Large">Youth X-Large </option>
<option value="Adult Small">Adult Small </option>
<option value="Adult Medium">Adult Medium </option>
<option value="Adult Large">Adult Large </option>
<option value="Adult X-Large">Adult X-Large </option>
<option value="Adult XX-Large">Adult XX-Large </option>
</select> </td></tr>

<!-- List 2 -->
<option value="Youth Large">Youth Large</option>
<option value="Youth X-Large">Youth X-Large</option>
<option value="Adult Small">Adult Small</option>
<option value="Adult Medium">Adult Medium</option>
<option value="Adult Large">Adult Large</option>
<option value="Adult X-Large">Adult X-Large</option>
<option value="Adult XX-Large">Adult XX-Large</option>

1 个答案:

答案 0 :(得分:0)

使用Jquery的更改功能

$("#idofselect").change(function(){ });