我想从列表中循环选择的号码(cfselect)。我尝试了 getElementById 但只能在同一页面上显示它。我无法将此数字传递给循环。有人能帮我吗?谢谢你。
function item()
var a = document.formName.numList.selectedIndex;
document.getElementById('i').value = document. family.tBro.options[a].value;
var n=document. family.tBro.options[a].value;
<!----OTHER INPUT TEXT BOXES --->
<cfform name="family" action="complete.cfm" method="post">
How many brothers do you have?
<cfselect name="tBro" onChange="item();" required="yes">
<option value="1"> 1</option>
<option value="2"> 2</option>
<option value="3"> 3</option>
<option value="4">4</option>
</cfselect>
<!---DISPLAY THE SELECTED CHOICE from getElementById--->
Total number of brothers: <cfinput type="text" name="i" id="i">
<!---LOOP x amount of time from selected choice above.
For example, if 2 is selected, the below info will display two times
--->
<cfinput type="text" name="firstname" required="yes">
<cfinput type="text" name="lastname" required="yes">
<cfinput type="text" name="Age" required="yes">
<cfinput type="text" name="Ocupation" required="yes">
<!--- END LOOP--->