i need help creating a table with any number entered
is if the number 5 was entered
a 5 by 5 table will appear
i was able to create the table
but it would show 25 cells in a row apeared
here is the code i have made so far:
[QUOTE]
<body>
<table border = ‘0’ bgcolor=’#f3f3f3′>
enter a number greater than 1 and a frame will be created.<br><br>
<script language=”JavaScript”>
var framenum = parseInt(prompt(“Enter a number greater than 1″,””)); //takes the users input and stores it in variable framenum
if (isNaN(framenum) || (framenum< 0)){document.write(“<strong>please refresh the page and type in number greater than 1</strong><br>”);} //if number is less than 0 or greater than 100000 tells user the number is not correct
if ((framenum>=1)){window.document.write(“the number you have chosen is ” + framenum+”.<br>”);} //if the number is correct prints the number and the equal sign
var array;
function createarray(n) {
array = new Array(n);
for (i = 0 ; i < n ; i = i + 1) {
array[i] = new Array(n) ;
}
for (i = 0, k = 1; i < n ; i = i + 1) {
for (j = 0; j < n ; j = j + 1, k = k + 1) {
array[i][j] = k ;
}
}
}
var i, j;
createarray(framenum);
for (i = 0; i < framenum; i = i + 1) {
for (j = 0; j < framenum; j = j + 1) {
document.write(“<td>table</td>”);
}
}
</script>
</table>
</body>