<select onchange="selected(this)"> <optgroup label="A"> <option value="http://www.glambox.com/apple">Apple</option> </optgroup> <optgroup label="B"> <option value="http://www.glambox.com/burberry">burberry</option> </optgroup> <optgroup label="C"> <option value="http://www.glambox.com/index.php?route=product/manufacturer/info&manufacturer_id=9">Canon</option> </optgroup> <optgroup label="D"> <option value="http://www.glambox.com/demo">demo</option> </optgroup> </select>
这代代码要求点击相应的连接跳转到相应的页面,js代码如下
<script> function selected(o){ location.href=o.value; } </script>
上面的select也可以这样写
<select onchange="location.href=this.value">