ํฐ์คํ ๋ฆฌ ๋ทฐ
<%@ 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>JSON ์ ์ด์ฉํ ๊ฐ์ฒด์์ฑ</title>
<script type="text/javascript">
//:::::::::::::::::::::: ๋ฐฉ๋ฒ 1 ::::::::::::::::::::::
var stu = {
name : "ํ๊ธธ๋",
school : "ํ๋ฒ๋๋๋",
subject : "์จ์์ฌ๋ฐฐ",
grade : 3,
friends :[
{name : "๋ฐ์ฌ๋ฒ"},
{name : "๋์ด์ฟค"},
{name : "์ฅ์ฐ์"}
],
toString : function() {
var txt =
"์ด๋ฆ์ " + stu.name + "์ด๊ณ <br/> " +
"ํ๊ต๋ " + stu.school + "์ด๋ค <br/> " +
"๊ทธ์ ๊ณผ๋ชฉ์ " + stu.subject + " <br/> " +
"ํ๋
์ " + stu.grade + "<br/> " +
"์น๊ตฌ๋ ";
for(i in this.friends) {
txt += this.friends[i].name;
if(i != this.friends.length-1) {
txt += ", ";
}
}
txt += "์ด(๊ฐ) ์๋ค";
return txt;
}
};
document.write ( stu.toString() );
//:::::::::::::::::::::: ๋ฐฉ๋ฒ 2 ::::::::::::::::::::::
//var tmp;
//tmp = "";
//for(i = 0; i < stu.friends.length ; i++) {
// tmp = tmp + stu.friends[i].name + ", ";
//}
/*
document.write(
"์ด๋ฆ์ " + stu.name + "์ด๊ณ <br/> " +
"ํ๊ต๋ " + stu.school + "์ด๋ค <br/> " +
"๊ทธ์ ๊ณผ๋ชฉ์ " + stu.subject + " <br/> " +
"ํ๋
์ " + stu.grade + "<br/> " +
"์น๊ตฌ๋ค์ " + tmp + " ์ด ์๋ค. "
);
*/
</script>
</head>
<body>
</body>
</html>
'JS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
DOM ๊ฐ์ฒด 02 (0) | 2010.07.09 |
---|---|
DOM ๊ฐ์ฒด 01 (0) | 2010.07.09 |
JSON ์ด์ฉํ ๊ฐ์ฒด์์ฑ (0) | 2010.07.09 |
์๋ฐ์คํฌ๋ฆฝํธ class ๊ฐ๋ (0) | 2010.07.09 |
์๋ฐ์คํฌ๋ฆฝํธ ๊ธฐ์ด Obj (0) | 2010.07.09 |
- Total
- Today
- Yesterday
- Java
- ๋ฉ๋ฐฐํ
- ๋ณต๊ทผ์ด๋
- jQuery
- ํจ์
- ์๋ฆฌ
- ๋์ค
- I Don't Care
- ๊ฒฝ์ ์ฉ์ด
- JS
- EL
- ์์์ฌ์ด๋
- ์นด๋ฐ์จ๋ผ์ธ
- 8๋ง์ผ
- MySQL
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์ธํจ์ด
- asp
- php
- 2ne1
- JavaScript
- MS-SQL
- ์๋ธ๋ฆฟ
- Ajax
- ๊ธฐํ
- JSP
- JSON
- JSTL
- Servlet
- ์น์์ด์ ์
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |