JAVASCRIPT
JAVASCRIPT onclick getElementById사용해서 text값 변경하기
JDK's blog
2015. 11. 21. 10:44
안녕하세요
이제부터 textBox에 글자를 버튼으로 인해서 textBox를 변경하는 방법을 알려드릴꼐요.
도움이 되었으면 좋겠어요.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
<meta charset="utf-8"/>
<html>
<head>
<title>JDK's 블로그</title>
<script language="javascript">
//textBox에 jdk's blog를 추가합니다.
function input_Text(){
document.getElementById("test").value = 'JDK\'s blog';
}
</script>
</head>
<body>
<input type='text' id='test' value='test용'/><input type='button' onclick='input_Text()' value='버튼'/>
</body>
</html> |
cs |
이제 textBox 전후를 보여드릴꼐요.
document.getElementById("ID").value로 특정 ID를 가져다가 넣도록 했습니다.
위에 화면이 버튼 클릭전이고, 밑에가 클릭후에 나오는 화면이예요. 이만 마치겠습니다.