用HTML建立連動下拉選單
<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[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");
<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[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;
{
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]);
}
}
}
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>
</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>
</script>
</body>
</html>
相關文章
- html - 下拉選單HTML
- JavaScript動態建立select下拉選單JavaScript
- HTML select下拉選單HTML
- HTML select 下拉選單HTML
- HTML+CSS實現下拉選單HTMLCSS
- HTML+CSS+JQuery實現下拉選單滑鼠懸浮顯示下拉選單,取消隱藏HTMLCSSjQuery
- 使用 Java 在Excel中建立下拉選單JavaExcel
- 下拉選單
- HTML5-網頁標欄的下拉選單HTML網頁
- rails中使用form.select建立動態的下拉選單薦AIORM
- 下拉選單框和滾動條
- 動態建立選單
- jq+css+html打造下拉導航選單例項CSSHTML單例
- vue下拉選單Vue
- Spinner下拉選單
- JavaScript動態操作select下拉選單JavaScript
- select下拉選單二級聯動
- JavaScript 動態生成select下拉選單JavaScript
- 用HTML實現COMBOX 下拉選擇框 (轉)HTML
- Bootstrap下拉選單disabledboot
- 用下拉選單控制gridview的分頁View
- Vue.js自定義下拉選單,如何實現在下拉選單區域外點選即可關閉下拉選單的功能Vue.js
- 建立支援類別下拉選單的Oracle查詢表DMOracle
- 新浪微部落格戶端(6)-建立首頁下拉選單
- JavaScript實現HTML導航欄下拉選單[懸浮顯示]JavaScriptHTML
- 函式節流實現滑動下拉選單函式
- JavaScript動態生成年份select下拉選單JavaScript
- 出生日期三級聯動下拉選單
- C# winfrom省份和城市 下拉選單聯動C#
- kendoUI 多選下拉選單 kendoMultiSelectUI
- CSS 二級下拉選單CSS
- CSS二級下拉選單CSS
- jQuery 二級下拉選單jQuery
- DIV下拉式選單(轉)
- JavaScript動態設定select下拉選單預設選項JavaScript
- 選中select下拉選單項提交表單
- 用C#與XML建立動態分層選單(轉)XML
- 兩個select下拉選單的option相互移動