728x90
ex05.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
#it{
text-align: right;
}
table{
text-align: center;
}
.btn{
width: 40px;
}
</style>
<script>
function myclick(obj){
var obj_it = document.querySelector('#it');
var str_new = obj.value;
var str_old = obj_it.value;
obj_it.value = str_old + str_new;
}
function mycall(){
var obj_it = document.querySelector('#it');
var str_tel = obj_it.value;
alert("calling\n"+str_tel);
}
</script>
</head>
<body>
EX05
<table border="1">
<tr>
<td colspan="3">
<input type="text" id="it"/>
</td>
</tr>
<tr>
<td><input class="btn" type="button" value="1" onclick="myclick(this)"/></td>
<td><input class="btn" type="button" value="2" onclick="myclick(this)"/></td>
<td><input class="btn" type="button" value="3" onclick="myclick(this)"/></td>
</tr>
<tr>
<td><input class="btn" type="button" value="4" onclick="myclick(this)"/></td>
<td><input class="btn" type="button" value="5" onclick="myclick(this)"/></td>
<td><input class="btn" type="button" value="6" onclick="myclick(this)"/></td>
</tr>
<tr>
<td><input class="btn" type="button" value="7" onclick="myclick(this)"/></td>
<td><input class="btn" type="button" value="8" onclick="myclick(this)"/></td>
<td><input class="btn" type="button" value="9" onclick="myclick(this)"/></td>
</tr>
<tr>
<td><input class="btn" type="button" value="0" onclick="myclick()"/></td>
<td colspan="2"><input class="btn" type="button" value="CALL" onclick="mycall()"/></td>
</tr>
</table>
</body>
</html>
'Python > Muzi' 카테고리의 다른 글
JS강화학습07. 홀/짝게임 만들기 (0) | 2023.07.12 |
---|---|
JS강화학습06. 별찍기 (0) | 2023.07.12 |
JS강화학습04. 구구단 생성해서 출력하기 (0) | 2023.07.12 |
JS강화학습03. 로또번호 생성해서 출력하기 (0) | 2023.07.12 |
JS강화학습02. 버튼 클릭시 input text 값 가져와서 연산하고 출력하기 (0) | 2023.07.12 |