本文发表在 rolia.net 枫下论坛要实现的功能是
摁一下choose1, 在selectitem的form里出现需要的options,然后选择一个值, 再摁一下itemslect button, 在choose1的value changed to the item selected。
同样对button choose2也是一样的。两者的不同是option的不同。
多谢
<html>
<head>
<script type="text/javascript">
function buildSelect(x,y,step) { //alert(x) ; //return
count = 0;
for(i=y;i>x;i=i-step){
document.selectform.selectmenu.options[count] = new Option(i)
count++;
}
return;
}
function sentSelect(target, value) { //alert(x) ; //return
document.targetform.choice.value = 12;
return;
}
</script>
</HEAD>
<BODY>
<div align="center">
<form name="selectform">
<select name="selectmenu" size = "2">
<option size="2">
</select>
<input type=button value="Item Select Item" onClick="sentSelect("targetform",this.form.selectmenu)">
<br>
</form>
</div>
<form name=targetform1>
Item1: <input type=button name=choice1 onClick="buildSelect(1,10,2)" value=" >> Choose1 << "><br>
Item2: <input type=button name=choice2 onClick="buildSelect(1,20,1)" value=" >> Choose2 << "><br>
<p>
</form>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net
摁一下choose1, 在selectitem的form里出现需要的options,然后选择一个值, 再摁一下itemslect button, 在choose1的value changed to the item selected。
同样对button choose2也是一样的。两者的不同是option的不同。
多谢
<html>
<head>
<script type="text/javascript">
function buildSelect(x,y,step) { //alert(x) ; //return
count = 0;
for(i=y;i>x;i=i-step){
document.selectform.selectmenu.options[count] = new Option(i)
count++;
}
return;
}
function sentSelect(target, value) { //alert(x) ; //return
document.targetform.choice.value = 12;
return;
}
</script>
</HEAD>
<BODY>
<div align="center">
<form name="selectform">
<select name="selectmenu" size = "2">
<option size="2">
</select>
<input type=button value="Item Select Item" onClick="sentSelect("targetform",this.form.selectmenu)">
<br>
</form>
</div>
<form name=targetform1>
Item1: <input type=button name=choice1 onClick="buildSelect(1,10,2)" value=" >> Choose1 << "><br>
Item2: <input type=button name=choice2 onClick="buildSelect(1,20,1)" value=" >> Choose2 << "><br>
<p>
</form>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net