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
관리 메뉴

기록

자바스트립트 전화번호 누르기 (파이썬8) 본문

JAVASCRIPT&JQUERY

자바스트립트 전화번호 누르기 (파이썬8)

9400 2023. 1. 10. 15:35
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
table{
	text-align : center;
}

#it{
	width : 120px;
	text-aling : right;
}

#btn1,#btn2,#btn3,#btn4,#btn5,#btn6,#btn7,#btn8,#btn9,#btn0{
	width : 35px;
}
</style>
<script type="text/javascript">
function myclick(obj){
	let it = document.querySelector('#it');
	let num = obj.value;
	let newNum =  num;
	let oldNum = it.value;
	
	it.value= oldNum + newNum;
}


function mycall(){
	let obj_it = document.querySelector('#it');
	let tel = obj_it.value;
	alert("Calling\n"+tel);
}

</script>
</head>
<body>
<table border="1">
	<tr>
		<td colspan="3">
			<input type="text" id="it" />
		</td>
	</tr>
	<tr>
		<td><input type="button" id="btn1" value="1" onclick="myclick(this)"/></td>
		<td><input type="button" id="btn2" value="2" onclick="myclick(this)"/></td>
		<td><input type="button" id="btn3" value="3" onclick="myclick(this)"/></td>
	</tr>
	<tr>
		<td><input type="button" id="btn4" value="4" onclick="myclick(this)"/></td>
		<td><input type="button" id="btn5" value="5" onclick="myclick(this)"/></td>
		<td><input type="button" id="btn6" value="6" onclick="myclick(this)"/></td>
	</tr>
	<tr>
		<td><input type="button" id="btn7" value="7" onclick="myclick(this)"/></td>
		<td><input type="button" id="btn8" value="8" onclick="myclick(this)"/></td>
		<td><input type="button" id="btn9" value="9" onclick="myclick(this)"/></td>
	</tr>
	<tr>
		<td><input type="button" id="btn0" value="0" onclick="myclick(this)"/></td>
		<td colspan="2"><input type="button" id="btnCall" value="CALL" onclick="mycall()" /></td>
	</tr>

</table>
</body>
</html>

출력성공

Comments