<!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>Javascript DOM Test</title>
<script>
function on_LoadStart(event)
{
alert("loadStart");
}
function on_LoadError(event)
{
alert("loadError");
}
function on_CompleteXMLData(event)
{
alert("complete");
//var zzz = event.srcElement.responseText;
var zzz = this.responseText;
if(this.responseXML != null)
{
var list =document.getElementById("list");
var imageList = this.responseXML.getElementsByTagName("image");
var strList ="";
for(var i=0;i<imageList.length;i++)
{
strList+= i+", "+imageList[i].attributes["src"].nodeValue+"<br>";
}
list.innerHTML =strList;
}
}
function on_Loadend()
{
alert("on_LoadEnd");
}
function on_Click()
{
var client = new XMLHttpRequest();
client.onloadstart = on_LoadStart;
client.onerror = on_LoadError;
client.onload = on_CompleteXMLData;
client.onloadend = on_Loadend;
client.open("GET", "http://www.ncqr.net/real/1.xml", true);
client.send();
}
</script>
</head>
<body>
<input type="button" value="load" onClick="on_Click()"><br>
<div id="list" style="width:400px;height:100px">
</div>
</body>
</html>
'Mobile Programming > HTML/JavaScript' 카테고리의 다른 글
Javascript APP 실행 (Android, IOS) 웹에서 앱 실행하기 (1) | 2014.07.09 |
---|
댓글