-1
我在寻找类似于3天的解决方案,但我无法获得最终部分以使其成为可能。Magento中的链接下拉菜单不能正常工作
我的问题是我无法建立我的3菜单之间的依赖关系。
这意味着的C选项应该依赖于值在B中选择和B的选择必须依赖于值A.即A-> B->选定的C
我只得到一个菜单 - > b,但不是b - > c。
如果有人可以给我一个新的代码来处理,我只需要在选项中。
这是我的代码:
<html>
<head>
<style type="text/css">
</style>
<script language="Javascript">
<!-- Start
function update_auswahl1() {
var speicher;
var auswahl1 = document.forms.verzeichnis.auswahl1;
var auswahl2 = document.forms.verzeichnis.auswahl2;
var auswahl3 = document.forms.verzeichnis.auswahl3;
auswahl2.options.length = 0; // DropDown Menü entleeren
auswahl3.options.length = 0; // DropDown Menü entleeren
//********************** AUSWAHL 1 ****************************************************************
if (auswahl1.options[auswahl1.selectedIndex].value == "a") {
auswahl2.options[0] = new Option("d");
auswahl2.options[1] = new Option("e");
} else if (auswahl1.options[auswahl1.selectedIndex].value == "b") {
auswahl2.options[0] = new Option("e");
auswahl2.options[1] = new Option("f");
} else if (auswahl1.options[auswahl1.selectedIndex].value == "c") {
auswahl2.options[0] = new Option("f");
auswahl2.options[1] = new Option("g");
} else if (auswahl1.options[auswahl1.selectedIndex].value == "") {
auswahl2.options[0] = new Option("---- Bitte waehlen ----");
}
//*************************************************************************************************
//********************* AUSWAHL 2 *****************************************************************
if (auswahl2.options[auswahl2.selectedIndex].values == "d") {
auswahl3.options[0] = new Option("h");
auswahl3.options[1] = new Option("i");
auswahl3.options[2] = new Option("j");
} else if (auswahl2.options[auswahl2.selectedIndex].values == "e") {
auswahl3.options[0] = new Option("i");
auswahl3.options[1] = new Option("j");
auswahl3.options[2] = new Option("k");
} else if (auswahl2.options[auswahl2.selectedIndex].values == "f") {
auswahl3.options[0] = new Option("k");
auswahl3.options[1] = new Option("l");
auswahl3.options[2] = new Option("m");
}
}
//*************************************************************************************************
// Ende -->
</script>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="verzeichnis">
<select size="1" name="auswahl1" onChange="update_auswahl1()">
<option value="" selected>---- Bitte wählen ----</option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
<br>
<br>
<select size="1" name="auswahl2">
<option selected>---- Bitte wählen ----</option>
</select>
<br>
<br>
<select name="auswahl3" size="1">
<option selected>---- Bitte wählen ----</option>
</select>
</form>
</body>
</html>
我很感谢4每一个帮助
哇那是一个非常大的帮助,感谢 但如果我想提出一个更菜单,我不知道该怎么做,u能可能帮助我吗? from 3 - > 4 – VioX
您可以在全局变量中处理select.value。留下一个函数(而不是我的两个函数),并且只有在前一个select.value的值已被更改时才重新填充。 –