Hi all.I have done some deep research on returning strings to an element id, and on for loops, but for some reason i cant seem to return the value of the text box i created. Instead, it returns a value of "NaN". The function that is returning "NaN" is "ztest()".
Here is the code as follows:
I simply need the text box to return the value of the box to the element.Code:<script> <!--Hide from old browsers var x1 = 0; var x2 = 0; var num=4; function ztest(){ if('document.test.forms.blah+x1.onClick'){ if(document.getElementById('boxes').innerHTML != null || document.getElementById('boxes').innerHTML != ""){ document.getElementById("zztest").innerHTML += document.test.forms.blah+x1.value; }else{ alert('enter!'); } } } function zsubmit(){ if('document.forms.test.zzsubmit.onClick'){ x2++; } alert(x2); } --> </script> <form name="test"> <p align="Center"> <script> <!--Hide from old browsers function addbox(){ if('document.forms.test.add.onClick'){ x1++; } document.getElementById('boxes').innerHTML += 'Name '+x1+': <input type="text" onClick="ztest();" 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="zsubmit();" 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>
thanks!
~SI~



I have done some deep research on returning strings to an element id, and on for loops, but for some reason i cant seem to return the value of the text box i created. Instead, it returns a value of "NaN". The function that is returning "NaN" is "ztest()".
Reply With Quote

Bookmarks