View Full Version : Need help sending text value to element..

05-17-2009, 06:32 PM
Hi :) 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");".

Here is the code box:

<!--Hide from old browsers

var x1=0;
var num=4;

function ztest(){


if (document.getElementById('boxes').innerHTML != null || document.getElementById('boxes').innerHTML != "") {


} else {




<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;


<!--Hide from old browsers
function addbox(){

if ('document.forms.test.add.onClick') {
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');



Thanks for all the help :)