下拉框连动的小例子(.htm版)

2016-01-29 17:18 3 1 收藏

下拉框连动的小例子(.htm版),下拉框连动的小例子(.htm版)

【 tulaoshi.com - ASP 】

  <html
<head
<titleList</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[1] = new Array("嘉定区","01","002");
subcat[2] = new Array("黄浦区","01","003");
subcat[3] = new Array("南昌市","02","004");
subcat[4] = new Array("九江市","02","005");
subcat[5] = 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][1] == locationid)
            {
            document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    

//--
</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
 

来源:https://www.tulaoshi.com/n/20160129/1500943.html

延伸阅读
  最近终于有时间研究研究AJAX了.看了一些AJAX的介绍. 用ProtoType框架完成的一个下拉框(asp:DropDownList)联动的AJAX的小例子,和初学者分享一下. 代码下载 <script language="javascript" type="text/javascript"  <!-- function goCity() {         var&nbs...
标签: Web开发
HTML HEAD titleAjax实现无刷新三联动下拉框/title meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" meta content="C#" name="CODE_LANGUAGE" meta content="JavaScript" name="vs_defaultClientScript" meta content="http://schemas.microsoft.com/intellis...
  问题提出: 我用dw做了一个下拉菜单,但是碰到form的列表项就跑到下面去了,请帮忙解决,请看问题图示如下: 解决问题: 由于层与下拉框之间的优先级是:下拉框  层,因此在显示的时候,会因为优先级的次序而会出现如上问题。(如果几个元素都是层的话,我们可以通过层的 z-index 属性来设置)解决办法就是:给层中...
标签: Web开发
代码如下: //==========测试代码=============== head runat="server" title下拉框测试/title script type="text/javascript" src="/js/jquery/jquery-1.3.js"/script script type="text/javascript" $(function(){ var $city= $("#ddlCity"); //填充一些数据 for(var i=1;i=10;i++){ $city.append($("option/").attr("value",i).t...
标签: ASP
  先建两个下拉选框(单选,SELECT),分别为select_month和select_day,在select_month被改变时触发change_it()函数,(select_month.onchange=change_it;)下面是该函数的源码: function change_it() { get_select=select_month.selectedIndex; select_item_m=select_month.options[get_select].text switch(select_item_m) { ca...

经验教程

262

收藏

14
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部