ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

JS

DOM ๊ฐ์ฒด 01

๐Ÿ”ฅ fire 2010. 7. 9. 21:25

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!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=EUC-KR">
<title>Node Access ์—ฐ์Šต</title>
<script type="text/javascript">
//์œˆ๋„์šฐ๊ฐ€ ๋ชจ๋‘ ๋กœ๋“œ๋˜๋ฉด ๋ฒ„ํŠผ์— ์ด๋ฒคํŠธ๋ฅผ ๋“ฑ๋กํ•œ๋‹ค.
window.onload = function() {
 //๋ฒ„ํŠผ์„ ์ฐพ์•„๋ผ.
 var btn = document.getElementById("btn");
 
 //๋ฒ„ํŠผ์— ํด๋ฆญ์ด๋ฒคํŠธ๋ฅผ ๋งคํ•‘ํ•œ๋‹ค.
 btn.onclick = function() {
  //๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด id๋ผ๋Š” ์•„์ด๋””๋ฅผ ๊ฐ€์ง„ ์š”์†Œ์˜ ๊ธ€์ž๋ฅผ ์ถœ๋ ฅํ•˜์ž.

  var id = document.getElementById("id");
  alert(id.value);
 }
}
</script>
</head>
<body>
 <input type="text" id="id" size="20" />
 <input type="button" id="btn" value="GoGoGo" />
 
</body>
</html>

'JS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Ajax ์‹œ์ž‘  (0) 2010.07.12
DOM ๊ฐ์ฒด 02  (0) 2010.07.09
JSON ์ด์šฉํ•œ ๊ฐ์ฒด toString  (0) 2010.07.09
JSON ์ด์šฉํ•œ ๊ฐ์ฒด์ƒ์„ฑ  (0) 2010.07.09
์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ class ๊ฐœ๋…  (0) 2010.07.09
๋Œ“๊ธ€