我对此代码有疑问:
<script type="text/javascript">// <![CDATA[
var Opleidingen=[
[""],
["Try one", "try two"],
["1","2","3"]
];
function Box2(idx) {
var f=document.myform;
f.box2.options.length=null;
for(var i=0; i<Opleidingen[idx].length; i++) {
f.box2.options[i]=new Option(Opleidingen[idx][i], i);
}
}
window.onload=function() {
var box1=document.myform.box1;
box1.onchange=function(){Box2(this.selectedIndex);};
// create 2nd select
try { // IE
var sel=document.createElement("<select name=\"box2\"><\/select>");
}
catch(e) {
var sel=document.createElement("select");
sel.name = "box2";
}
document.myform.getElementsByTagName('fieldset')[0].insertBefore(sel,
box1.nextSibling);
// fill 2nd select
Box2(0);
}
// ]]></script>
<form action="(??????????????????????)" method="post" name="myform">
<fieldset><legend></legend><select name="box1">
<option disabled="" selected="">- Test -</option>
<optgroup label="Choose value test">
<optgroup label="A">
<option value="1">Value list 1 (1)</option>
<option value="5">Value list 2 (2)</option>
<option value="6">Value list 3 (3)</option>
start</option>
</select>
<button type="submit">Zoeken</button></fieldset>
</form>
我尝试将此列为依赖下拉列表,其中第二个列表中的每个值都与链接匹配。例如:
(列表1)值列表1 - (列表2)尝试一个 - 链接:google.nl (列表1)值列表2 - (列表2)2 - 链接:yahoo.nl
最后都在同一个按钮上。我刚刚开始编码,所以我非常感谢你的帮助!在哪里放入代码