note

JavaScript 반복문 for (구구단) 본문

JavaScript/기본

JavaScript 반복문 for (구구단)

투한 2012. 2. 1. 17:24




<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript 반복문 for</title>
</head>
<body>
	<h1>구구단</h1>
	<script type="text/javascript">
		document.write("<table width='90%' cellpadding='2' cellspacing='2' border='1'>")
		for (var i = 2; i <= 9; i++) {
			document.write("<tr>");
			for (j = 1; j <= 9; j++) {
				document.write("<td>");
				document.write(i + " * " + j + " = " + i * j);
				document.write("</td>");
			}
			document.write("</tr>");
		}
		document.write("</table>");
	</script>
</body>
</html>

'JavaScript > 기본' 카테고리의 다른 글

JavaScript check, radio  (0) 2012.02.01
JavaScript 반복문 while  (0) 2012.02.01
JavaScript 조건문 if  (0) 2012.02.01
JavaScript 외부 문서 삽입형  (0) 2012.02.01
JavaScript 함수형  (0) 2012.02.01