|
I'm trying to create a code generator, but I'm having problems storing the information, because part of it is a table, and there is no way of knowing how many fields will be needed. Anyway, what I need to do is create a number of hidden fields to store the information, then get it when everything is done.
Right now, I'm just doing
for(i=0; i<cols; i++) { // Input stuff here document.write('<input type="hidden" name="name" value="stuff_entered' + i + '" />'; }
Then, in the next step (this is all one page, with a js function switching between what <div> section is visible), it will need to get the information to create the code. I tried using this:
for(i=0; i<document.formName.stuff_entered.value; i++) { // Code to write out the code }
When I try that, I get an error saying that document.formName.stuff_entered has no properties. Anyone have any suggestions about how to get around that?
|
Support Rob Scuderi, the #1 Penguins Defender!
"Behold: me! I have authority in this building."
|
|
|
|
var i = 0; while(document.formName["stuff_entered"+i]){ alert(document.formName["stuff_entered"+i].value); i++; }
|
|
|
|