HTML interesse |
|
hallo,
ik ben iets aan het proberen, maar het lukt niet zo
<html>
<head>
<title>Gadget</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
var http = createRequestObject();
function handleHttpResponse() {
if (http.readyState == 4) {
// Split the comma delimited response into an array
document.getElementById('inhoud').value = http.responseText;
}else{
document.getElementById('inhoud').value = "geen resultaat";
}
}
function getTrav(user) {
http.open('get', 'http://travian.valdocx.be/gadget.php?user='+user, true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function createRequestObject() {
var req;
if(window.XMLHttpRequest){
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert('Problem creating the XMLHttpRequest object');
}
return req;
}
</script>
</head>
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="getTrav('valdocx');">
<div class="main">
<div class="smaller">
<div id="inhoud">
</div>
<input type="button" value="refresh" onClick="getTrav('valdocx')"/>
</div>
</div>
</body>
</html>
<link href="style.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript"> var http = createRequestObject(); function handleHttpResponse() { if (http.readyState == 4) { // Split the comma delimited response into an array document.getElementById('inhoud').value = http.responseText; }else{ document.getElementById('inhoud').value = "geen resultaat"; } } function getTrav(user) { http.open('get', 'http://travian.valdocx.be/gadget.php?user='+user, true); http.onreadystatechange = handleHttpResponse; http.send(null); } function createRequestObject() { var req; if(window.XMLHttpRequest){ req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert('Problem creating the XMLHttpRequest object'); } return req; } <body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="getTrav('valdocx');"> <input type="button" value="refresh" onClick="getTrav('valdocx')"/>
de tekst die ik inlaad wordt niet weergegeven
|