本文发表在 rolia.net 枫下论坛<html>
<head>
<script type="text/javascript">
var selectedButton;
function buildSelect(x,y,step,selButton) { //alert(x) ; //return
selectedButton = selButton;
count = 0;
for(i=y;i>x;i=i-step){
document.selectform.selectmenu.options[count] = new Option(i)
count++;
}
return;
}
function sentSelect(evalue) { //alert(x) ; //return
alert(selectedButton.value);
selectedButton.value = evalue;
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(document.selectform.selectmenu.options[document.selectform.selectmenu.selectedIndex].text);">
<br>
</form>
</div>
<form name=targetform>
Item1: <input type=button name=choice1 onClick="buildSelect(1,10,2,this)" value=" >> Choose1 << "><br>
Item2: <input type=button name=choice2 onClick="buildSelect(1,20,1,this)" value=" >> Choose2 << "><br>
<p>
</form>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net
<head>
<script type="text/javascript">
var selectedButton;
function buildSelect(x,y,step,selButton) { //alert(x) ; //return
selectedButton = selButton;
count = 0;
for(i=y;i>x;i=i-step){
document.selectform.selectmenu.options[count] = new Option(i)
count++;
}
return;
}
function sentSelect(evalue) { //alert(x) ; //return
alert(selectedButton.value);
selectedButton.value = evalue;
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(document.selectform.selectmenu.options[document.selectform.selectmenu.selectedIndex].text);">
<br>
</form>
</div>
<form name=targetform>
Item1: <input type=button name=choice1 onClick="buildSelect(1,10,2,this)" value=" >> Choose1 << "><br>
Item2: <input type=button name=choice2 onClick="buildSelect(1,20,1,this)" value=" >> Choose2 << "><br>
<p>
</form>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net