<SELECT onchange="window.location.href=this.options
[this.selectedIndex].value">
<OPTION VALUE="0">categories</OPTION>
<OPTION VALUE="cat1">1</OPTION>
<OPTION VALUE="cat2">2</OPTION>
<OPTION VALUE="cat3">3</OPTION>
</SELECT>这样的代码可以运行跳转
<SELECT onchange="window.location.href=this.options
[this.selectedIndex].value">
<OPTION VALUE="0">categories</OPTION>
<OPTION selected ="selected" VALUE="cat1">1</OPTION>
<OPTION VALUE="cat2">2</OPTION>
<OPTION VALUE="cat3">3</OPTION>
</SELECT>但如果有一个默认选项selected的话,就不能跳转到cat1,只能跳转到其它的。有什么解决办法么?
[this.selectedIndex].value">
<OPTION VALUE="0">categories</OPTION>
<OPTION VALUE="cat1">1</OPTION>
<OPTION VALUE="cat2">2</OPTION>
<OPTION VALUE="cat3">3</OPTION>
</SELECT>这样的代码可以运行跳转
<SELECT onchange="window.location.href=this.options
[this.selectedIndex].value">
<OPTION VALUE="0">categories</OPTION>
<OPTION selected ="selected" VALUE="cat1">1</OPTION>
<OPTION VALUE="cat2">2</OPTION>
<OPTION VALUE="cat3">3</OPTION>
</SELECT>但如果有一个默认选项selected的话,就不能跳转到cat1,只能跳转到其它的。有什么解决办法么?
if (changed)
window.href= ;
else
window.href=selected;
<SELECT onmousedown="this.selectedIndex=0" onchange="location.href=this.options[this.selectedIndex].value">
<OPTION VALUE="0">categories </OPTION>
<OPTION selected ="selected" VALUE="cat1">1 </OPTION>
<OPTION VALUE="cat2">2 </OPTION>
<OPTION VALUE="cat3">3 </OPTION>
</SELECT>
加了这个,selected的能选,没selected的就不能选了
<OPTION VALUE="0">categories </OPTION>
<OPTION selected ="selected" VALUE="cat1">1 </OPTION>
<OPTION VALUE="cat2">2 </OPTION>
<OPTION VALUE="cat3">3 </OPTION>
</SELECT>