wallacer
07-08-2005, 08:49 PM
I'm trying to get code that will create a user specified number of text input boxes on the screen, and then be able to access them individually. I have tried a few approaches and can't get one to work. Here's what I tried:
function getRounds()
{ totalRounds = prompt ('How Many rounds in total?',"")
for (i = 1; i <= totalRounds; i++){
document.write("<input type='text' name = 'round"+i+"' style = 'width: 100'>Round"+i+" ")
}
}
Then in another function i call:
document.write(": "+document. roundlevels.round1.value)
//I really want to call roundlevels.currentRound.value is there a way to go to a deeper level like roundlevels.round(valueofcurrentRound).value?
the html is:
<form name = "roundlevels" onsubmit="0">
<script>getRounds()</script>
<script>displaycurrentRound()</script>//the other function </form>
Any Help on this problem would be greatly appreciated, thanks in advance,
Wallacer
function getRounds()
{ totalRounds = prompt ('How Many rounds in total?',"")
for (i = 1; i <= totalRounds; i++){
document.write("<input type='text' name = 'round"+i+"' style = 'width: 100'>Round"+i+" ")
}
}
Then in another function i call:
document.write(": "+document. roundlevels.round1.value)
//I really want to call roundlevels.currentRound.value is there a way to go to a deeper level like roundlevels.round(valueofcurrentRound).value?
the html is:
<form name = "roundlevels" onsubmit="0">
<script>getRounds()</script>
<script>displaycurrentRound()</script>//the other function </form>
Any Help on this problem would be greatly appreciated, thanks in advance,
Wallacer