coldfusion-如何循环在同一页面中从getElementById传递的值?
我想从列表中循环选择的号码(cfselect)。我尝试了getElementById,但只能在同一页上显示它。我无法将此数字传递给循环。有人能帮我吗?多谢各位coldfusion-如何循环在同一页面中从getElementById传递的值?,coldfusion,Coldfusion,我想从列表中循环选择的号码(cfselect)。我尝试了getElementById,但只能在同一页上显示它。我无法将此数字传递给循环。有人能帮我吗?多谢各位 function item() var a = document.formName.numList.selectedIndex; document.getElementById('i').value = document. family.tBro.options[a].value; va
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--->
功能项()
var a=document.formName.numList.selectedIndex;
document.getElementById('i')。value=document。family.tBro.options[a].值;
var n=文档。family.tBro.options[a].值;
你有几个兄弟?
1.
2.
3.
4.
兄弟总数:
提示:陈述您试图完成的任务,而不是实现。为了理解您的需求,我不得不重读了几遍,在这种情况下,您的实现并不是很合适
您试图将JavaScript传递给CFM代码:这不是它的工作方式。ColdFusion在服务器上呈现;JavaScript在客户端上呈现。调用item()时,ColdFusion已完成其所有呈现;不能对item()的结果执行CF循环
如果没有真正复杂的AJAX解决方案,您有两种选择:
提示:陈述你想要完成的,而不是实现。为了理解您的需求,我不得不重读了几遍,在这种情况下,您的实现并不是很合适 您试图将JavaScript传递给CFM代码:这不是它的工作方式。ColdFusion在服务器上呈现;JavaScript在客户端上呈现。调用item()时,ColdFusion已完成其所有呈现;不能对item()的结果执行CF循环 如果没有真正复杂的AJAX解决方案,您有两种选择:
您可能会从阅读以下内容中受益:@ulazing-Tip:要发布cfml/html代码,只需使用工具栏中的代码ie
{}
按钮。这将保留
。您可能会从中受益:@ula Zing-Tip:要发布cfml/html代码,只需使用工具栏中的代码ie{}
按钮。这将保留
。