js带有介绍的导航栏效果

js带有介绍的导航栏效果
该js效果,单机我们的上边选项,下边会出现介绍,当我们点击前往时候,会跳转到相应的界面。


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>带有介绍的导航栏效果</title>
</head>
<body>
      <h3>带有介绍的导航栏效果</h3>
      <form name="stationform">
          <select name="refsel" onchange="textValue()" multiple size="5">
              <option title="提供免费的杀毒服务">360安全卫士</option>
              <option title="百度一下">百度一下</option>
              <option title="谷歌搜索">谷歌搜索</option>
              <option title="网易">网易</option>
              <option title="搜狐网">搜狐网</option>
              <option title="新浪网">新浪网</option>
          </select>
          <p>
             <input type="button" name="stationbutton" value="前往" onclick="herfto()">
          </p>
          <p>
              <input type="text" name="stationtext" value="" size="30" maxlength="35" style="border: 1px solid red;">
          </p>
      </form>

       <script type="text/javascript">
                function herfto(){
                    if(document.stationform.refsel.options[0].selected)
                    {
                        window.location.href="http://www.360.cn";
                    }
                    else if(document.stationform.refsel.options[1].selected)
                    {
                        window.location.href="http://www.baidu.com";
                    }
                    else if(document.stationform.refsel.options[2].selected)
                    {
                        window.location.href="http://www.google.com";
                    }
                    else if(document.stationform.refsel.options[3].selected)
                    {
                        window.location.href="http://www.163.com";
                    }
                    else if(document.stationform.refsel.options[4].selected)
                    {
                        window.location.href="http://www.sohu.com";
                    }
                    else if(document.stationform.refsel.options[5].selected)
                    {
                        window.location.href="http://www.sina.com";
                        return true;
                    }
                }

                function textValue(){
                    var stationInteger,stationString;
                    stationInteger=document.stationform.refsel.selectedIndex;
                    stationString=document.stationform.refsel.options[stationInteger].title;
                    document.stationform.stationtext.value=stationString;
                }
       </script>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值