九九乘法表js

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_22079371/article/details/81709770
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<!--顺的九九乘法表-->
		<script type="text/javascript">
			document.write('<table border="1" cellpadding="0" cellspacing="0" bgcolor="greenyellow" width="960px">');
				for(var i=1;i<=9;++i){
					document.write('<tr>');
						for(var j=1;j<=i;j++){
							document.write('<td>'+i+'X'+j+'='+(i*j)+'</td>')
						}
					document.write('</tr>');
				}
			document.write('</table>');
		</script>
		
		<!--倒的九九乘法表-->
		<script type="text/javascript">
			document.write('<th color="red">')
			document.write('<table border="1" cellpadding="0" cellspacing="0" bgcolor="blue" width="960px">');
				for(var i=9;i>=1;i--){
					document.write('<tr>');
						for(var j=1;j<=i;j++){
							document.write('<td>'+i+'X'+j+'='+(i*j)+'</td>')
						}
					document.write('</tr>');
				}
			document.write('</table>');
		</script>
	</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_22079371/article/details/81709770
今日推荐