Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags more
Archives
Today
Total
관리 메뉴

기록

자바스크립트 구구단 찍기(파이썬3) 본문

JAVASCRIPT&JQUERY

자바스크립트 구구단 찍기(파이썬3)

9400 2023. 1. 10. 14:30
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
#it{
	width : 40px;
}

#div_disp{
	height : 200px;
}
</style>
<script type="text/javascript">

function myclick(){
	let dan = document.querySelector('#it').value;
	code="";
	
	for(i=1; i<=9; i++){
		code += `${dan} * ${i} = ${dan*i} <br>`;
	}
	
	div_disp.innerHTML= code;
}

</script>
</head>
<body>
<table border="1">
	<tr>
		<td>출력단수 : </td>
		<td>
			<input type="text" id="it" />
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="button" onclick ="myclick()" value="출력하기" />
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<div id="div_disp"></div>
		</td>
	</tr>
</table>
</body>
</html>

출력성공

Comments