从select中选择option后如何转到相应的数据页面中去的JS代码
<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">