当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 连动下拉菜单

HTML/XHTML教程
理解表现和结构相分离
HTML语言剖析(一)Html简介
HTML语言剖析(二)HTML标记一览
HTML语言剖析(三)文件标记
HTML语言剖析(四)排版标记
HTML语言剖析(五)字体标记
HTML语言剖析(六)清单标记
采访Eric Meyer的10个问题
Flash页面如何通过校验
为什么要抛弃HTML
典型的三行二列居中高度自适应布局
盒模型bug的解决方法
用!important解决IE和Mozilla的布局差别
使用DIV之后,什么时候使用TABLE
同一个页面用多个id有什么影响
定义标题的最好方法
左中右3栏布局中最先显示中栏内容的方法
alt属性和title属性
在IE中为abbr标签加样式
HTML4标签的默认样式列表

HTML/XHTML教程 中的 连动下拉菜单


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 28 ::
收藏到网摘: n/a

<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
   
subcat = new Array();
subcat[0] = new Array("徐汇区","01","001");
subcat = new Array("嘉定区","01","002");
subcat = new Array("黄浦区","01","003");
subcat = new Array("南昌市","02","004");
subcat = new Array("九江市","02","005");
subcat = new Array("上饶市","02","006");

onecount=6;

function changelocation(locationid)
    {
    document.myform.smalllocation.length = 0;

    var locationid=locationid;
    var i;
    document.myform.smalllocation.options[0] = new Option('====所有地区====','');
    for (i=0;i < onecount; i++)
        {
            if (subcat[i] == locationid)
            {
            document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i]);
            }       
        }
       
    }   

//-->
</script>
</head>
<body>
<form name="myform" method="post">
    <select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)">
        <option value="01" selected>上海</option>
        <option value="02">江西</option>
    </select>
    <select name="smalllocation">
        <option selected value="">==所有地区==</option>
    </select>
</form>
<script LANGUAGE="javascript">
<!--
    changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value);

//-->
</script>
</body>
</html>