日期:2014-05-18  浏览次数:20810 次

尽我最大能力请教 jsp菜单联动问题。
上限最高只能给100分了。在历史中找了一下,也没找到合适的。

我的需求:   菜单里面有1   2   3   三项,三个菜单是一样的内容。当第一个菜单选择1以后,后两个菜单就不能或者看不到1了。只能选2或者3   .

------解决方案--------------------
有时真的又气又无奈哈,新人就是被欺负哈,问.net的问题, 人家回答一个,看msdn,找例子,人家回答一个去www.codeproject.com,要么就是用asp.net ,用javascript,用ajax,真的很希望听到一点有价值一点的, 哪怕不帖代码,说一下大致的实现思路也可以 $$#@$%$%
自己写了一个,和楼主共勉-----
<html>
<head>
<title> test </title>
<script language = "JavaScript ">
function Add()
{
str = document.yourForm.select1.options[document.yourForm.select1.selectedIndex].value;
//deleteOp();
switch( str )
{
case "1 ":
document.yourForm.yourSelect.options[0] = new Option( "option2 ", "2 ");
document.yourForm.yourSelect.options[1] = new Option( "option3 ", "3 ");
break;
case "2 ":
document.yourForm.yourSelect.options[0] = new Option( "option1 ", "1 ");
document.yourForm.yourSelect.options[1] = new Option( "option3 ", "3 ");
break;
case "3 ":
document.yourForm.yourSelect.options[0] = new Option( "option1 ", "1 ");
document.yourForm.yourSelect.options[1] = new Option( "option2 ", "2 ");
break;
default:
break;
}

}
</script>
</head>
<body>
<form name = "yourForm " >
<select name = "select1 " onChange = "Add() ">
<option value = "1 " selected> option1 </option>
<option value = "2 "> option2 </option>
<option value = "3 "> option3 </option>
</select>
<select name = "yourSelect " >
<option value = "2 " > option2 </option>
<option value = "3 "> option3 </option>
</form>
</body>
</html>
------解决方案--------------------
根据楼上那位兄弟的改的,
<html>
<head>
<title> test </title>
<script language = "JavaScript ">
function Add()
{
str = document.yourForm.select1.options[document.yourForm.select1.selectedIndex].value;
for(i=0;i <list.length;i++)//这个list里就是你数据库读出的记录比如list=[ "苹果 ", "香蕉 ", "芒果 ", "酸梨 ", "杨桃 ", "橙子 "];
{
if(!list[i].equals(str))
{
document.yourForm.yourSelect.options[i] = new Option( "list[i] ", "list[i] ");
}
}
}
</script>
</head>
<body>
<form name = "yourForm " >
<select name = "select1 " onChange = "Add() ">
<option value = "1 " selected> option1 </option>
<option value = "2 "> option2 </option>
<option value = "3 "> option3 </option>
</select>
<select name = "yourSelect " >
<option value = "2 " > option2 </option>
<option value = "3 "> option3 </option>
</form>
</body>
</html>