<html>
<head>
<title>
test
</title>
<script language="javascript">//var select1_len = document.frm.s1.options.length;
var select2 = new Array(4);
for (i=0; i<4; 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++", "C/C++");
select2[2][1] = new Option("Java", "Java");
select2[2][2] = new Option("C#", "C#");select2[3][0] = new Option("Perl", "Perl");
select2[3][1] = new Option("Ruby", "Ruby");
select2[3][2] = new Option("Python", "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>
</head>
<body>
<form name="frm">
<select name="s1" onChange="redirec(this.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>
</body>
</html>
怎样把两个下拉列表的值传递到第二页?

解决方案 »

  1.   

    把两个值作为参数传到第二页
    第二页的url?s1=1&s2=PHP
      

  2.   

    .......
    这个问题是基础的基础....自己去看下jsp的request和response,可以通过FORM也可以通过url传参
      

  3.   

    我想知道这个值怎么得到,如果选择的是第一个“脚本语言”,PHP,怎么得到的是“1”,第二个接收不到呢?
      

  4.   

    第一个SELECT传值可以了,但是第二个有的能传有的不能传是怎么回事呢?
      

  5.   

    select2[1][0] = new Option("PHP", " "); 
    select2[1][1] = new Option("ASP", " "); 
    select2[1][2] = new Option("JSP", " "); 你都没有设值,都设成空格了...