九九乘法表

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body,div,ul,li{
margin:0;
padding: 0;
font-family: Arial;
font-size:12px;
}
ul li{
list-style:none;
}
#tab{
position:absolute;
top:50%;
left:50%;
padding:10px;
margin-left:-460px;
margin-top:-145px;
width:900px;
height:270px;
border:1px solid red;
border-radius:10px;
}
#tab li{
height:30px;
line-height: 30px;

}
#tab li span{
width:100px;
height:30px;
text-align:center;
display: inline-block;
}
</style>
</head>
<body>
<div id='tab'>
<ul>

</ul>
</div>
<script type='text/javascript'>
var oTab = document.getElementById('tab');
var str = '';
str+="<ul>"
for(var i = 1;i<=9;i++){
str+="<li>";
for(var j = 1;j<=i;j++){
str+="<span>";
str+=""+j+"x"+i+" = "+(j*i)+""
str+="</span>"
}
str+="</li>"
}
str+="</ul>"
oTab.innerHTML = str;
</script>
</body>
</html>
posted @ 2017-06-29 19:46  likwin  阅读(145)  评论(0编辑  收藏  举报