select 标签可创建单选或多选菜单,很多时候需要实现链接跳转,下面是三种实现方法:
第一种方法:
- <html>
- <head>
- <metahttp-equiv=“Content-Type”content=“text/html;charset=gb2312”/>
- <title>select加链接</title>
- </head>
- <body>
- <SCRIPTlanguage=javascript>
- <!–
- functionmbar(sobj){
- vardocurl=sobj.options[sobj.selectedIndex].value;
- if(docurl!=“”){
- open(docurl,’_blank’);
- sobj.selectedIndex=0;
- sobj.blur();
- }
- }
- </SCRIPT>
- <Selectonchange=mbar(this)name=“select”>
- <OPTIONselected>===合作伙伴===</OPTION>
- <OPTIONvalue=“http://www.baidu.com”>百度</OPTION>
- <OPTIONvalue=“http://www.163.com”>网易</OPTION>
- <OPTIONvalue=“http://www.flash8.net/”>闪吧</OPTION>
- </Select>
- </body>
- </html>
第二种方法:
- <selectname=“pageselect”onchange=“self.location.href=options[selectedIndex].value”>
- <OPTIONvalue=“http://www.baidu.com”>百度</OPTION>
- <OPTIONvalue=“http://www.163.com”>网易</OPTION>
- </select>
第三种方法:带跳转按钮
- <html><head>
- <metahttp-equiv=“Content-Type”content=“text/html;charset=utf-8”/>
- <title>select选择-按钮跳转</title>
- <scripttype=“text/javascript”>
- functionsetsubmit()
- {
- if(mylink.value==0)
- window.location=’http:
- if(mylink.value==1)
- window.location=’http:
- if(mylink.value==2)
- window.location=’http:
- }
- </script>
- </head>
- <body>
- <selectname=“mylink”id=“mylink”>
- <OPTIONvalue=“0”>百度</OPTION>
- <OPTIONvalue=“1”>网易</OPTION>
- <OPTIONvalue=“2”>新浪</OPTION>
- </select>
- <inputtype=“button”id=“btn”value=“提交”onclick=“setsubmit(this)”/>
- </body>
- </html>
学点技术备用。



