码迷,mamicode.com
首页 > 其他好文 > 详细

下拉菜单

时间:2015-04-21 20:30:58      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>收集用户信息</title>
</head>
<body  onload="init()">
    <form action="/My/Home/Info" method="post" name="creator" enctype="multipart/form-data">
        <script language="javascript">
            var where = new Array(3);
            function comefrom(loca, locacity) { this.loca = loca; this.locacity = locacity; }
            where[0] = new comefrom("请选择数据库", "请选择数据库版本");
			where[1] = new comefrom("Microsoft SQL Server", "Microsoft SQL Server 2005|Microsoft SQL Server 2008|Microsoft SQL Server 2012|Microsoft SQL Server 2014");
            where[2] = new comefrom("Access", "Access 03|Access 05|Access 07");
            where[3] = new comefrom("Oracle", "Oracle 1|Oracle 2|Oracle 3");
            function select() {
                with (document.creator.province) { var loca2 = options[selectedIndex].value; }
                for (i = 0; i < where.length; i++) {
                    if (where[i].loca == loca2) {
                        loca3 = (where[i].locacity).split("|");
                        for (j = 0; j < loca3.length; j++) { with (document.creator.city) { length = loca3.length; options[j].text = loca3[j]; options[j].value = loca3[j]; var loca4 = options[selectedIndex].value; } }
                        break;
                    }
                }
                document.creator.newlocation.value = loca2 + loca4;
            }
            function init() {
                with (document.creator.province) {
                    length = where.length;
                    for (k = 0; k < where.length; k++) { options[k].text = where[k].loca; options[k].value = where[k].loca; }
                    options[selectedIndex].text = where[0].loca; options[selectedIndex].value = where[0].loca;
                }
                with (document.creator.city) {
                    loca3 = (where[0].locacity).split("|");
                    length = loca3.length;
                    for (l = 0; l < length; l++) { options[l].text = loca3[l]; options[l].value = loca3[l]; }
                    options[selectedIndex].text = loca3[0]; options[selectedIndex].value = loca3[0];
                }
            }
        </script>
            <label>数据库</label><div class="opts"></div><font color=#000000>
            <select class="sb" name="province" onchange="select()" style="width: 200px; height: 30px;"></select> 
			<select class="sb" name="city" onchange="select()" style="width: 200px; height: 30px;"></select>
        
		
        
    </form>

</body>
</html>

  

下拉菜单

标签:

原文地址:http://www.cnblogs.com/bidianqing/p/4445087.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!