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

HTML/XHTML教程
译文:如何写出漂亮的HTML代码
Web Slices是什么
select网页下拉列表与div层遮盖问题
202个免费的高质量XHTML模板(1)
202个免费的高质量XHTML模板(2)
验证HTML,CSS以及RSS源是否正确的免费工具
网页排版应该考虑IE6的兼容性问题
表单元素与提示文字无法对齐的问题
学习如何书写整洁规范的HTML标记
网页设计潮流之2009:路在何方?
制作网页的5条非常不错的建议
Xhtml不常用却很有用的标签
Google Wave将推动HTML5标准化
是否为img图片标签赋予alt属性
iframe高度自适应代码(兼容FF,Opera,Safari)
HTML教程:small标记
WEB标准:网页页面结构
如何修改网页中的FlashSWF文件
dl,dt,dd在什么时候适合使用呢?
shtml include使用方法

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 56 ::
收藏到网摘: 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>