实现效果
代码实现
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>3-九九乘法表</title>
<style>
td{
border: 1px solid black;
/* 内填充 */
padding: 10px 10px;
}
table{
/* 表格变成一道线 */
border-collapse: collapse;
}
</style>
</head>
<body>
<div id="charts">
</div>
</body>
<script>
function chartList(){
document.write("<table>");
for(var i = 1; i <= 9;i++){
document.write("<tr>");
for(var j = 1; j <= 9;j++){
if(j <= i){
document.write("<td>" + i + "*" + j + "=" + (i*j)+"</td>");
}else{
document.write("<td></td>");
}
}
document.write("</tr>");
}
document.write("</table>");
}
chartList();
</script>
</html>