码迷,mamicode.com
首页 > 其他好文 > 详细

使用函数打印出m乘法表

时间:2016-12-08 21:24:37      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:pre   window   html   doc   write   title   ble   asc   blog   

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">
	/*	使用函数打印出m乘法表 */

		function cf (m) {  
			var str ="<table width=‘600‘ align=‘center‘ border=‘1‘>";
				for(var i = 1;i<=m; i++)
				{
					str+="<tr>";

				for (var j= 1;j<=i; j++)
				{
					str+="<td>"+j+‘&times‘+i+‘=‘+(j*i)+"</td>";
				}
					str+="</tr>";
			}
					str+="</table>";
		
		document.write(str);
		}
		var num=window.prompt();
		cf(num);

	</script>
</body>
</html>

 

使用函数打印出m乘法表

标签:pre   window   html   doc   write   title   ble   asc   blog   

原文地址:http://www.cnblogs.com/243920934qq/p/6146311.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!