javascript - How can I erase a section of my table to display a message without touching the rest? -
i have created table made of 2 rows, first row checks if user input correct or not, , second row displaying button. have used following code inside script function inside first row of table display output response:
function checkuserinput() { var userinput = document.getelementbyid("textinput").value; var stringtocheckagainst = random_images_array[num].split('.'); //this splits item @ array index array, so. if item "apple.gif", array reads ["apple", "gif"] if (userinput == stringtocheckagainst[0]) { //user has inputted correct string //window.alert("user gave correct response!"); document.write("<p>" + txt.fontsize(5) + "</p>"); document.close(); } else { //user has inputted incorrect string //window.alert("user gave incorrect response!"); document.write("<p>" + txt1.fontsize(5) + "</p>"); document.close(); } } </script>
however code delete entire page (document). can advise me how write message top section of page (or table) , leave second row of table unchanged?
Comments
Post a Comment