document.write and .innerHTML
I have a piece of code.... Here is a small part of it: //(When they press the button, this code will start) var out = document.getElementById("ans"); for (var i = 0; i < input; i++) { var num = parseInt(Math.random() * 100); if (num > 78){ var output = char[0]; }else{ var output = char[num]; } out.innerHTML = output; //document.write(output); //You dont need to worry too much about the top code, just the output Ok, now this will produce lets say... 8 characters (S45#...) Now whenever I say document.write, it will give me all the characters, but on a new page... so i decided to make a <p></p> on the html file and give it an id called "ans"... Now i tried using out.innerHTML = output; to try and get it to paste in that paragraph, but it only gives me 1 character instead of 8... How do i get it to paste all 8 characters there?