<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script type= "Text/javascript" >
var str= ' <table border= "1" ><tr><td>bill gates</td></tr></table> ';
function init (row, col)
{
var myarray=new Array (13);//value of the element that stores the cell
var n= (Row*col)/2;
for (Var k=1;k<=n;k++)
{
myarray[k]= parseint (Math.random () *n);
myarray[(K+n)]=myarray[k];
}
var str= ' <table border= ' 1 "width=" "height=" > ";
for (Var i=1;i<=row;i++)
{
str+= "<tr>";
for (Var j=1;j<=col;j++)
{
str+= "<td onclick= ' Judge (" + ((i-1) *col+j) + "); ' > "+ myarray[(i-1) *col+j) +" </td> ";
}
str+= "</tr>";
}
str+= "</table>"
I=1 j=1---3 1 2 3 (i-1) *3+j
I=2 4 5 6
document.write (str);
document.getElementById ("Mt"). Innerhtml=str;
}
function CreateTable ()
{
var Row=document.getelementbyid ("T1"). Value;
var Col=document.getelementbyid ("T2"). Value;
Init (Row,col);
}
Function Judge (temp)
{
Alert (temp);
}
</script>
<body>
<div id= "MT" >test</div>
<input type= "Text" value= "3" id= "T1"/>
<input type= "Text" value= "4" id= "T2"/>
<input type= "button" value= "Production form" onclick= "createtable ();" />
</body>
Web Table Section Content