Javascript & JQuery & CSS > ¿ÜºÎ »çÀÌÆ® ºÒ·¯¿À´Â ¿¹Á¦
µî·ÏÀÏ : 2019-10-30 17:01
Á¶È¸¼ö : 53,856
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script>
window.onload = function(){
sendRequest("http://ankyu.entersoft.kr/test/test_ok.asp",displayLuck,null);
}
function sendRequest(url, callback, postData)
{
var req = createXMLHTTPObject();
if (!req) return;
var method = (postData) ? "POST" : "GET";
req.open(method,url,true);
req.setRequestHeader('User-Agent','XMLHTTP/1.0');
if (postData) req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
req.onreadystatechange = function ()
{
if (req.readyState != 4) return;
if (req.status != 200 && req.status != 304)
{
return;
}
callback(req);
}
if (req.readyState == 4) return;
req.send(postData);
}
var XMLHttpFactories = [
function () {return new XMLHttpRequest()},
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];
function createXMLHTTPObject()
{
var xmlhttp = false;
for (var i=0;i<XMLHttpFactories.length;i++)
{
try {
xmlhttp = XMLHttpFactories[i]();
}
catch (e) {
continue;
}
break;
}
return xmlhttp;
}
function displayLuck(luck)
{
var p = document.getElementById("luck");
p.innerHTML = "´ç½ÅÀº ¿À´Ã" + luck.responseText + "ÇÕ´Ï´Ù.";
}
</script>
</head>
<body>
<p id="luck"></p>
</body>
</html>