| |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| |
<head> |
| |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| |
<title>动态表格</title> |
| |
<script type="text\javascript"> |
| |
str+="</table>" |
| |
var row=3; |
| |
var col=3; |
| |
function ok(row,col) |
| |
{ |
| |
for(var i=0;i<row;i++) |
| |
{ |
| |
str+="<tr>"; |
| |
for(var j=0;j<col;j++) |
| |
{ |
| |
str+="<td>"+(i*3+j)+"</td>"; |
| |
} |
| |
str+="</tr>"; |
| |
} |
| |
str+="</table>"; |
| |
document.getElementById("w").innerHTML=str; |
| |
} |
| |
function cs() |
| |
{ |
| |
var row=document.getElementById("t1").value; |
| |
var col=document.getElementById("t2").value; |
| |
ok(row,col); |
| |
} |
| |
(/script) |
| |
</head> |
| |
<html> |
| |
<body> |
| |
<div id="w">test</div> |
| |
<input type="text" size="10" id="t1" /> |
| |
<input type="text" size="10" id="t2" /> |
| |
<input type="button" onclick="cs();" /> |
| |
</body> |
| |
</html> |
| |
</body> |
| |
</html> |
| |
|