SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
Thread: XMLHTTPRequest
-
Aug 22, 2006, 14:07 #1
- Join Date
- Aug 2006
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
XMLHTTPRequest
Code:<script> function displayMessage() { var req = null; if(window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch(e) { req = false; } } else if(window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } req.open("GET", "reload.php", true); req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { var chaine=req.responseText; var object=document.getElementById('chat'); if (chaine.length>4) { object.innerHTML= document.getElementById('chat').innerHTML+chaine; object.scrollTop=object.scrollHeight; } } else { alert("There was a problem retrieving the XML data:"); } } setTimeout('displayMessage()',2500); } req.send(null); } </script>
I dunno what can be causing it since this is my first attempt at this script and I dunno even what language I am programming in.
Help much appreciated.
Oh, if you want to have a look at the script to test for yourself
http://www.fantasy-express.com/xmlchat/
Bookmarks