florida
12-04-2006, 02:25 PM
I have about 30 inputs on my page using this in my form page and was wondering how I can call the same script part that is below in a function or a more efficient way of doing it so I dont have to put the <script>...</script> in my form 30 times.
<form action="goto.cfm" method="post">
<input name="other" type="text">
<input name="otherTwo" type="text">
<select name="stateIssue">
<script language="javascript">
for (var i=1; i<101;i++) {
document.write ("<option value='"+i+"'>"+i+"</option>")
}
</script>
</select>
<input name="otherA" type="text">
<input name="otherTwoB" type="text">
<select name="mynameCity">
<script language="javascript">
for (var i=1; i<101;i++) {
document.write ("<option value='"+i+"'>"+i+"</option>")
}
</script>
</select>
<input name="other" type="text">
<input name="otherTwo" type="text">
...
</form>
<form action="goto.cfm" method="post">
<input name="other" type="text">
<input name="otherTwo" type="text">
<select name="stateIssue">
<script language="javascript">
for (var i=1; i<101;i++) {
document.write ("<option value='"+i+"'>"+i+"</option>")
}
</script>
</select>
<input name="otherA" type="text">
<input name="otherTwoB" type="text">
<select name="mynameCity">
<script language="javascript">
for (var i=1; i<101;i++) {
document.write ("<option value='"+i+"'>"+i+"</option>")
}
</script>
</select>
<input name="other" type="text">
<input name="otherTwo" type="text">
...
</form>