JavaScript中的下拉菜单 [英] Dropdown in javascript

查看:59
本文介绍了JavaScript中的下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下程序的功能代码是什么?.

Hi,

What is the function code of the following program..?

"
<html><head>
<script type="text/javascript">
function update_list()
{
var lists = new Array();
lists['punjab']  = new Array();
lists['punjab'][0] = new Array('Barnala','Sangrur','Bathinda');

lists['Haryana']    = new Array();
lists['Haryana'][0] = new Array('Ambala','Hisar','Shabad');

       lists['Maharastra']= new Array();
 lists['Maharastra'][0] = new Array('Mumbai','pune');
 function initList()
{
 ///Statement
}
</script>
</head>
<body>
<form name="myform" id="myform">
<select name="myselect" id="myselect" >
<option >--select--<option>
<option value="1">Punjab</option>
<option value="2">Haryana </option>
<option value="3"> Maharastra</option>
</select>
<select name="myselects" id="myselects"></select>
</form>
</body>
</html>
"

推荐答案

我看起来很像是看到了一个表单,您可以从中选择一个区域,并取决于选择的区域更详细的区域选择.

另外,您也应该删除该问题的先前不完整版本,这是不好的形式,请问两次.
I looks very much like you are presented with a form from which you select a Region, and dependant upon which region you select you are offered a more detailed area selection.

Also you should delete the previous incomplete version of this question, it is bad form to ask twice.


好吧,JavaScript不在任何地方,因此有两个下拉菜单.
第一个具有3个值(旁遮普,哈里亚纳邦,马哈拉施特拉邦).第二个是空的.
就是这样.

P.S.如果完整地编写了Javascript并使其与下拉更改事件挂钩,则代码正朝着层叠下拉菜单"发展.
Well, Javascript is not hooked up anywhere so, a form with two dropdowns.
First one with 3 values (Punjab, Haryana, Maharashtra). Second one empty.
Thats it.

P.S. If Javascripts are written completekly and hooked to dropdown change event, code is moving towards ''Cascading Dropdown''.


这篇关于JavaScript中的下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆