[javascript]代码库
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js九九乘法表</title>
<style type="text/css">
table {
width: 800px;
height: 300px;
border-collapse: collapse;
}
table th {
border: 1px solid #069;
}
body {
text-align: center;
}
h1 {
font-family: "微软雅黑", Verdana, sans-serif, "宋体";
color: #666;
font-weight: bold;
margin-bottom: 30px;
}
</style>
</head>
<body>
<script type="text/javascript">
document.write("<table>");
var str = "js九九乘法表";
document.write("<h1>" + str + "</h1>");
for ( var x = 1; x <= 9; x++) {
document.write("<tr>");
for ( var y = 1; y <= x; y++) {
document.write("<th>" + x + "*" + y + "=" + (x * y) + "</th>");
}
document.write("</tr>");
}
document.write("</table>");
</script>
</body>
</html>
[代码运行效果截图]
中级程序员
by: 9亿土狗的梦 发表于:2017-06-23 16:10:54 顶(7) | 踩(4) 回复
666
回复评论