技术支持
select标签中<option>标签如何设置为超链接形式
方式一:给监听select标签的change事件使用window.open()进行跳转
<select onchange="window.open(this.options[this.selectedIndex].value,target='_blank')">
<option value="">请选择</option>
<option value="https://blog.csdn.net/m0_73334325?spm=1001.2101.3001.5343">测试文字</option>
</select>
-------------------------------------------------------------------
<body>
<select name="select" onchange="mbar(this)">
<option value="省重要网站">省重要网站</option>
<option value="http://www.ln.gov.cn/"> 辽宁省</option>
</select>
<script>
function mbar(eventHtml){
var targetUrl = eventHtml.options[eventHtml.selectedIndex].value;
if(targetUrl!=''){
open(targetUrl,'_blank')
}
}
</script>
</body>
方式二:给监听select标签的change事件使用location.href进行跳转
<select name="select" onchange="self.location.href='options[selectedIndex].value'">
<option value="省重要网站">省重要网站</option>
<option value="http://www.ln.gov.cn/"> 辽宁省</option>
</select>
文章搜索
