<option value="0" value="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
<script type="text/javascript">
function request(){
var obj = {};
var arr = window.location.search.slice(1).split("&");
for (var i = 0, len = arr.length; i < len; i++) {
var nv = arr[i].split("=");
obj[unescape(nv[0]).toLowerCase()] = unescape(nv[1]);
}
return obj;
}
var req = request();
document.getElementById("stype").value = req.stype;
</script>
百度了一下 都是要修改value这个的,但是这里value值是不能改的,A标签又失效,求怎么给每个下拉菜单加个本地超链接
3 个解决方案
#1
你自定义一个属性呗
<select id="stype" onChange="location.replace(this.options[this.selectedIndex].getAttribute('data-href'))">
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
<select id="stype" onChange="location.replace(this.options[this.selectedIndex].getAttribute('data-href'))">
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
#2
谢谢,成功了,非常感谢
#3
<select id="stype" onChange="location.replace(this.options[this.selectedIndex].getAttribute('data-href'))">
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
#1
你自定义一个属性呗
<select id="stype" onChange="location.replace(this.options[this.selectedIndex].getAttribute('data-href'))">
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
<select id="stype" onChange="location.replace(this.options[this.selectedIndex].getAttribute('data-href'))">
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
#2
谢谢,成功了,非常感谢
#3
<select id="stype" onChange="location.replace(this.options[this.selectedIndex].getAttribute('data-href'))">
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>
<option value="0" data-href="http://www.163.com">所有服务</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
</select>