HiOk, I've done some more research and managed to make this work. Now there's only a few problems left. When I enter something into the box then hit the submit button, it does add the "var a = new Array("a");", but it shows on the webpage, and not in document.getElementById("test").innerHTML. and when I click submit again, it keeps adding "var a = new Array("a");" "var a = new Array("a");" "var a = new Array("a");" instead of "var a = new Array("a","a");".
Here is the code box:
Thanks for all the helpCode:<script> <!--Hide from old browsers var x1=0; var num=4; function ztest(){ if('document.forms.test.zzsubmit.onClick'){ if (document.getElementById('boxes').innerHTML != null || document.getElementById('boxes').innerHTML != "") { zname(); } else { alert('enter!'); } } } --> </script> <form name="test"> <p align="Center"> function zname(){ var vname = new Array("a"); var comma = '","'; var a = new Array(document.forms.test['blah'+x1].value); var str = ""; str += 'var '+vname[0]+' = new Array("'; str += a.join(comma); str += '");'; document.getElementById("test").innerHTML += str; } </script> <script> <!--Hide from old browsers function addbox(){ if ('document.forms.test.add.onClick') { x1++; } document.getElementById('boxes').innerHTML += 'Name '+x1+': <input type="text" name="blah'+x1+'"><br>\n'; } document.write('<span id="zztest" style="background-Color: #44CFFC; width: 400px; height: 50px;"></span><script>for(var x=1;x<=2;x++){document.write(\'<br>\');}</script>\n'); document.write('<input type="button" name="add" value="Add box" onClick="addbox();">\n'); document.write('<input type="button" name="zzsubmit" onClick="ztest();" value="Submit"><br>\n'); document.write('<a href="javascript:window.opener=false, window.close(\"-1\");">Exit</a><br>\n'); document.write('<span id="boxes" style="background-Color: #44CFFC; width: 400px; height: 25px;"></span><br>\n'); --> </script> </p> </form>
~SI~



Ok, I've done some more research and managed to make this work. Now there's only a few problems left. When I enter something into the box then hit the submit button, it does add the "var a = new Array("a");", but it shows on the webpage, and not in document.getElementById("test").innerHTML. and when I click submit again, it keeps adding "var a = new Array("a");" "var a = new Array("a");" "var a = new Array("a");" instead of "var a = new Array("a","a");".
Reply With Quote
Bookmarks