Element
01-20-2006, 05:20 AM
Attention Staff Members: I think I might have put this in the wrong forum now that I look at a brief summary of DOM...
I have this script on my site, and according to Velox Letum, it worked on his site, but for some reason it has a problem in IE and FireFox. Also, Velox said IE should be using Sarissa, why is it still trying to use the Ajax method?
Here is the line with the problem according to the error:
for (i = 0; i < xmlhttp.responseXML.getElementsByTagName('onlinenum')[0].firstChild.data; i++) {
And here is the whole script:
<script language='JavaScript' type='text/javascript'>
var xmlhttp = new XMLHttpRequest();
function reloadusers() {
// Set up the request
xmlhttp.open('POST', 'ajax.php', true);
// The callback function
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var users = new Array();
for (i = 0; i < xmlhttp.responseXML.getElementsByTagName('onlinenum')[0].firstChild.data; i++) {
users[i] = xmlhttp.responseXML.getElementsByTagName('userlink')[i].firstChild.data;
}
document.getElementById('users').innerHTML = '<b>Users Online</b><br />' + users.join(', ');
setTimeout("reloadusers()", 10000);
xmlhttp.close;
}
}
}
// Send the GET request
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send('ajax=true');
}
reloadusers();
</script>
I know no JavaScript and am not sure whats wrong. the XML php file with the mysql results seems to be just fine.
I have this script on my site, and according to Velox Letum, it worked on his site, but for some reason it has a problem in IE and FireFox. Also, Velox said IE should be using Sarissa, why is it still trying to use the Ajax method?
Here is the line with the problem according to the error:
for (i = 0; i < xmlhttp.responseXML.getElementsByTagName('onlinenum')[0].firstChild.data; i++) {
And here is the whole script:
<script language='JavaScript' type='text/javascript'>
var xmlhttp = new XMLHttpRequest();
function reloadusers() {
// Set up the request
xmlhttp.open('POST', 'ajax.php', true);
// The callback function
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var users = new Array();
for (i = 0; i < xmlhttp.responseXML.getElementsByTagName('onlinenum')[0].firstChild.data; i++) {
users[i] = xmlhttp.responseXML.getElementsByTagName('userlink')[i].firstChild.data;
}
document.getElementById('users').innerHTML = '<b>Users Online</b><br />' + users.join(', ');
setTimeout("reloadusers()", 10000);
xmlhttp.close;
}
}
}
// Send the GET request
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send('ajax=true');
}
reloadusers();
</script>
I know no JavaScript and am not sure whats wrong. the XML php file with the mysql results seems to be just fine.