실제 예제
<%@ 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> <style type="text⁄css"> div { margin : 10px; border :3px Solid Black; border-radius:10px; float:left; width:120px; height :120px; text-align:center; } <⁄style> <meta http-equiv="Content-Type" content="text⁄html; charset=EUC-KR"> <script src="http:⁄⁄code.jquery.com⁄jquery-1.7.js"><⁄script> <script> var xml='<friends>'; xml+= ' <friend>'; xml+= ' <name>연하진<⁄name>'; xml+= ' <language>Ruby<⁄language>'; xml+= ' <⁄friend>'; xml+= ' <⁄friends>'; $(document).ready(function () { var xmlDoc = $.parseXML(xml); $(xmlDoc).find('friend').each(function(index){ var output=''; output+='<div>'; output+=' <h1>' + $(this).find('name').text() + '<⁄h1>'; output+=' <p>' + $(this).find('language').text() + '<⁄p>'; output+='<⁄div>'; document.body.innerHTML += output; }); }); <⁄script> <⁄head> <body> <⁄body> <⁄html>
결과 화면
'JavaScript&Web' 카테고리의 다른 글
[Javascript] 빈칸체크하기 간단예제 (0) | 2013.05.21 |
---|---|
[JavaScript] click 이벤트 발생 예제 (0) | 2013.03.31 |
[JavaScript] jquery를 가지고 css 주기 (0) | 2013.03.31 |
[JavaScript] Java 와 JavaScript 는 무엇이 다른걸까? (0) | 2013.03.29 |
[Web] HTML 태그 정리표 (0) | 2013.03.29 |