主頁 > 知識庫 > html select標(biāo)簽加鏈接3種方法

html select標(biāo)簽加鏈接3種方法

熱門標(biāo)簽:網(wǎng)站建設(shè) 硅谷的囚徒呼叫中心 百度競價點擊價格的計算公式 美圖手機 使用U盤裝系統(tǒng) 智能手機 檢查注冊表項 阿里云
第一種

復(fù)制代碼
代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>select加鏈接</title>
</head>
<body>
<SCRIPT language=javascript>
<!--
// open the related site windows
function mbar(sobj) {
var docurl =sobj.options[sobj.selectedIndex].value;
if (docurl != "") {
open(docurl,'_blank');
sobj.selectedIndex=0;
sobj.blur();
}
}
//-->
</SCRIPT>
<Select onchange=mbar(this) name="select">
<OPTION selected>=== 合作伙伴 ===</OPTION>
<OPTION value="http://www.baidu.com">百度</OPTION>
<OPTION value="http://www.163.com">網(wǎng)易</OPTION>
<OPTION value="http://www.flash8.net/">閃吧</OPTION>
</Select>
</body>
</html>

第二種

復(fù)制代碼
代碼如下:

<select name="pageselect" onchange="self.location.href=options[selectedIndex].value" >
<OPTION value="http://www.baidu.com">百度</OPTION>
<OPTION value="http://www.163.com">網(wǎng)易</OPTION>
</select>

第三種帶跳轉(zhuǎn)按鈕的

復(fù)制代碼
代碼如下:

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>select選擇-按鈕跳轉(zhuǎn)</title>
<script type="text/javascript">
function setsubmit()
{
if(mylink.value == 0)
window.location='http://www.baidu.com';
if(mylink.value == 1)
window.location='http://www.163.com';
if(mylink.value == 2)
window.location='http://www.sina.com';
}
</script>
</head>
<body>
<select name="mylink" id="mylink">
<OPTION value="0">百度</OPTION>
<OPTION value="1">網(wǎng)易</OPTION>
<OPTION value="2">新浪</OPTION>
</select>
<input type="button" id="btn" value="提交" onclick="setsubmit(this)" />
</body>
</html>

標(biāo)簽:湘潭 山南 賀州 懷化 煙臺 黃山 湖北 通遼

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《html select標(biāo)簽加鏈接3種方法》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266