HTML interesse |
|
Ik heb deze code:
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;
}
var http = createRequestObject();
function sendRequest(url, id) {
http.open('get', url);
http.onreadystatechange = handleResponse(id);
http.send(null);
}
function handleResponse(id) {
if(http.readyState == 4 && http.status == 200){
if(http.responseText) {
document.getElementById(id).innerHTML = http.responseText;
} else {
document.getElementById(id).innerHTML = " ";
}
} else {
document.getElementById(id).innerHTML = " ";
}
}
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; } var http = createRequestObject(); function sendRequest(url, id) { http.open('get', url); http.onreadystatechange = handleResponse(id); http.send(null); } function handleResponse(id) { if(http.readyState == 4 && http.status == 200){ if(http.responseText) { document.getElementById(id).innerHTML = http.responseText; } else { document.getElementById(id).innerHTML = " "; } } else { document.getElementById(id).innerHTML = " "; } }
En dan om alles te tonen:
<div id="tw-bbcode-content-400-199">Loading...</div>
<script type="text/javascript" src="bovenstaandecode.js"></script>
<script type="text/javascript">
<!--
sendRequest(".../index.php?option=village&x=400&y=199", "tw-bbcode-content-400-199");
//-->
</script>
<div id="tw-bbcode-content-400-199">Loading... </div> <script type="text/javascript" src="bovenstaandecode.js"></script> <script type="text/javascript"> <!-- sendRequest(".../index.php?option=village&x=400&y=199", "tw-bbcode-content-400-199"); //-->
|