您的位置:首页 > Web前端 > JavaScript

js--九九乘法表

2014-02-22 10:15 405 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
document.write("<table>");

for(var x=1 ; x<=9; x++)
{
document.write("<tr>");
for(var y=1 ; y<=x; y++)
{
document.write( "<th>"+y+"*"+x+"="+x*y+"</th>");
}
document.write("</tr>");
}
document.write("</table>");
</script>
<style type="text/css">
table{
width:600px;
border-collapse:collapse;
}
table th{
border:#0033CC 1px solid;
}
</head>

<body>

</body>
</html>

1*1=1
1*2=22*2=4
1*3=32*3=63*3=9
1*4=42*4=83*4=124*4=16
1*5=52*5=103*5=154*5=205*5=25
1*6=62*6=123*6=184*6=245*6=306*6=36
1*7=72*7=143*7=214*7=285*7=356*7=427*7=49
1*8=82*8=163*8=244*8=325*8=406*8=487*8=568*8=64
1*9=92*9=183*9=274*9=365*9=456*9=547*9=638*9=729*9=81
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: