唐山網(wǎng)站建設(shè)在做友情鏈接經(jīng)常要用到
select跳轉(zhuǎn)菜單新窗口
方法一:
<select onchange="goUrl(this.options[this.selectedIndex]);">
<option>==</option>
<option value='http://www.csdn.net' target="_blank">csdn</option>
<option value='http://www.163.com' target="_self">163.com</option>
</select>
<script>
function goUrl(obj){
if(obj.target=='_blank')window.open(obj.value);
if(obj.target=='_self')location.href=obj.value;
}
</script>
方法二:
select頁面跳轉(zhuǎn)及獲值
<selectonchange="window.location.href=this.options[selectedIndex].value">
<option value="http://www.google.com">谷歌</option>
<option value="http://www.yahoo.com">雅虎</option>
<option value="http://www.baidu.com">百度</option>
</select>
ASP調(diào)用方法:
<select onchange="window.open(this.options[this.selectedIndex].value)">
<option value="" selected="selected">--請(qǐng)選擇--</option>
<%set rsxw=server.CreateObject("adodb.recordset")
rsxw.open"select top 6 * from (select * from xw where xwlb_id=10 order by tjsj desc)",cn,1,3
for j=1 to rsxw.recordcount
%>
<option value="<%=rsxw("lj")%>" target="_blank"><%=rsxw("xwbt")%></option>
<%rsxw.next
next
rsxw.close
set rsxw=nothing%>
</select>