<html>
<head>
<style>
table{
border-collapse: collapse;
border: 1px solid gray;
text-align: center;
width: 600px;
}
table td, table th{
border: 1px solid gray;
}
<style>
</head>
<body>
<input type="button" value="显示九九乘法表" οnclick="jiujiu()" />
<table id="mytab"></table><script>
function jiujiu(){
var mytab=document.getElementById("mytab");
for(i=1; i<=9; i++){
mytab.insertRow(i-1);
for(j=1; j<=i; j++){
mytab.rows[i-1].insertCell(j-1);
mytab.rows[i-1].cells[j-1].innerHTML=j+"*"+i+"="+(j*i);
mytab.rows[i-1].cells[j-1].className="bgtd";
}
}
}
</script>
</body>
</html>
(点一次按钮出现一个九九乘法表)