<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title></title> | |
<meta http-equiv="content" content="text/html" charset="utf-8"/> | |
<style type="text/css"> | |
</style> | |
<script type="text/javascript"> | |
function f1() | |
{ | |
var tab=document.createElement('table'); | |
tab.setAttribute('border','1'); | |
tab.setAttribute('width','100%'); | |
// | |
var obd=document.createElement('tbody'); | |
tab.appendChild(obd); | |
// | |
for(i=0;i<9;i++) | |
{ | |
obd.insertRow(i); | |
for(j=0;j<i+1;j++) | |
{ | |
obd.rows[i].insertCell(j); | |
obd.rows[i].cells[j].appendChild(document.createTextNode((j+1)+'x'+(i+1)+'='+(i+1)*(j+1))); | |
} | |
} | |
document.body.appendChild(tab); | |
} | |
</script> | |
</head> | |
<body> | |
<input type="button" value="form" onclick="f1()"> | |
</body> | |
</html> |
用JS实现乘法表
最新推荐文章于 2024-08-28 17:12:18 发布