99乘法表
今天使用js制作99乘法表,强迫症的我只能这么做……
以下是效果图,哎呀妈,变形了,凑活看吧~~~~
下面就来看看我这49行代码咋写的吧
强迫症的人,真是苦逼
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>九九乘法表</title>
<style>
p {
width: 100px;
text-align: left;
display: inline-block;
padding: 10px;
margin: 0px;
font-size: 18px;
background-color: aquamarine;
border-top: 1px solid #000000;
border-right: 1px solid #000000;
}
p {
display: block;
}
#zheng99 {
width: auto;
display: inline-block !important;
display: inline;
border-left: 1px solid #000000;
border-bottom: 1px solid #000000;
}
</style>
</head>
<body>
<h1>9*9乘法表</h1>
<p id="zheng99"></p>
</body>
<script>
window.onload = function() {
for(var i = 1; i <= 9; i++) {
ps = document.getelementbyid("zheng99").innerHTML += "<p></p>";
for(var j = 1; j <= i; j++) {
document.getElementById("zheng99").getElementsByTagName("p")[i - 1].innerHTML += "<p>" + j + " x " + i + " = " + (j * i) + "</p>";
}
}
}
</script>
</html>