js带有介绍的导航栏效果

来源:互联网 发布:a byte of python pdf 编辑:程序博客网 时间:2024/04/30 14:35
js带有介绍的导航栏效果
该js效果,单机我们的上边选项,下边会出现介绍,当我们点击前往时候,会跳转到相应的界面。


<!DOCTYPE HTMLPUBLIC "-//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>
     <formname="stationform">
        <select name="refsel"onchange="textValue()" multiplesize="5">
           <optiontitle="提供免费的杀毒服务">360安全卫士</option>
           <optiontitle="百度一下">百度一下</option>
           <optiontitle="谷歌搜索">谷歌搜索</option>
           <optiontitle="网易">网易</option>
           <optiontitle="搜狐网">搜狐网</option>
           <optiontitle="新浪网">新浪网</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 solidred;">
        </p>
    </form>

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

             function textValue(){
                 varstationInteger,stationString;
                stationInteger=document.stationform.refsel.selectedIndex;
                stationString=document.stationform.refsel.options[stationInteger].title;
                document.stationform.stationtext.value=stationString;
             }
     </script>
</body>
</html>
0 0
原创粉丝点击