I have this problem I have been working on for a few days. I need to make a page that requests the user for 12 letters, and click the submit button. I cannot make what I have come up with work. Suggestions are welcomed! The Javascript that is run should do the following: Generate a random number 1-3, for the number of rows, and put the 12 characters into a formatted table. For example, a random generated table might produce the following:
Text entered: abcdefghijkl
a b c
d e f
g h i
j k l
Or:
a b c d
e f g h
i j k l
etc.
My HTML:
<form name="table">
<p>Enter 12 letters</p>
<input type="text" id= "userVal" size="12">
<input type="button" value="submit" onclick="createTable()">
Javascript:
var numrows= randomnumber=Math.floor(Math.random()*4)
var numcols=4
document.write ("<table border='1'>")
for (var i=1; i<=numrows; i++)
{
document.write ("<tr>");
for (var j=1; j<=numcols; j++)
{
document.write ("<td>" + i*j + "</td>");
}
document.write ("</tr>");
}
document.write ("</table>");
function createTable(){