在eclipse中用javascript编写九九乘法表

<!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=gb2312" />
<title>九九乘法表</title>
<style type="text/css">table{width:60px;
border-collapse:collapse;
}
table th{
border:#0066cc 1px solid
}
</style>
</head>
<body>
<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 +" = " +y*x+"</th>");
}
document.write("</tr>");
}
document.write("</table>");

</script>

</body>
</html>

发布了35 篇原创文章 · 获赞 400 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/weixin_40752764/article/details/104668677