3个回答
展开全部
jsp设置二级联动的下拉列表的例子如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | < html > < head > < title >This is a test!</ title > </ head > < body > < form name = "frm" > < select name = "s1" onChange = "redirec(document.frm.s1.options.selectedIndex)" > < option selected>请选择</ option > < option value = "1" >脚本语言</ option > < option value = "2" >高级语言</ option > < option value = "3" >其他语言</ option >//下拉列表数据 </ select > < select name = "s2" > < option value = "请选择" selected>请选择</ option > </ select > </ form > < script language = "javascript" > //获取一级菜单长度 var select1_len = document.frm.s1.options.length; var select2 = new Array(select1_len); //把一级菜单都设为数组 for (i=0; i< select1_len ; i++) { select2[i] = new Array();} //定义基本选项 select2[0][0] = new Option("请选择", " "); select2[1][0] = new Option("PHP", " "); select2[1][1] = new Option("ASP", " "); select2[1][2] = new Option("JSP", " "); select2[2][0] = new Option("C/C++", " "); select2[2][1] = new Option("Java", " "); select2[2][2] = new Option("C#", " "); select2[3][0] = new Option("Perl", " "); select2[3][1] = new Option("Ruby", " "); select2[3][2] = new Option("Python", " "); //联动函数 function redirec(x) { var temp = document.frm.s2; for ( i = 0 ;i<select2[x].length;i++) { temp.options[i]=new Option(select2[x][i].text,select2[x][i].value);} temp.options[0] .selected = true ; } </script> </ body > </ html > |
展开全部
jsp设置二级联动的下拉列表的例子如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
<head>
<title>This is a test!</title>
</head>
<body>
<form name="frm">
<select name="s1" onChange="redirec(document.frm.s1.options.selectedIndex)">
<option selected>请选择</option>
<option value="1">脚本语言</option>
<option value="2">高级语言</option>
<option value="3">其他语言</option>//下拉列表数据
</select>
<select name="s2">
<option value="请选择" selected>请选择</option>
</select>
</form>
<script language="javascript">
//获取一级菜单长度
var select1_len = document.frm.s1.options.length;
var select2 = new Array(select1_len);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
<head>
<title>This is a test!</title>
</head>
<body>
<form name="frm">
<select name="s1" onChange="redirec(document.frm.s1.options.selectedIndex)">
<option selected>请选择</option>
<option value="1">脚本语言</option>
<option value="2">高级语言</option>
<option value="3">其他语言</option>//下拉列表数据
</select>
<select name="s2">
<option value="请选择" selected>请选择</option>
</select>
</form>
<script language="javascript">
//获取一级菜单长度
var select1_len = document.frm.s1.options.length;
var select2 = new Array(select1_len);
展开全部
用<ul><li>标签来做,嵌套一层就可以。<li>标签和<li>中的<a>标签都设定宽高和float:left。
设置外层<li>标签position:relative;内层<ul>标签position:absolute;left和top属性设定好就能够准确定位。
设置外层<li>标签position:relative;内层<ul>标签position:absolute;left和top属性设定好就能够准确定位。
本回答被提问者采纳
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询