SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    this giant script doesnt work in IE!

    It works fine in firefox... I don't know why it doesn't work in IE, what's in here that doesn't work in IE! I know it's confusing but I have no idea what doesn't work please help!

    Let me explain, GetXmlHttpObject creates, well, an xml object (for ajax). showhint gets the data from a certain site, and then after the "state changed" it goes to stateChanged which checks if the entire action is complete, and if it is does a few things which don't matter.

    Thanks if possible!

    Code:
    var xmlHttp;
    	
    function showHint()
    	{
    	xmlHttp=GetXmlHttpObject()
    	if (xmlHttp==null)
    			{
    			alert ("Browser does not support HTTP Request")
    			return
    			} 
    	var url="http://www.arcticsheep.org/chatroom/data.php"
    	xmlHttp.onreadystatechange=stateChanged 
    	xmlHttp.open("GET",url,true)
    	xmlHttp.send(null)
    	} 
    	
    function stateChanged() 
    	{ 
    	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    			{
    			document.getElementById("hidcom").innerHTML = xmlHttp.responseText;
    			if (document.getElementById("commentbox").innerHTML != document.getElementById("hidcom").innerHTML && xmlHttp.responseText != "")
    					{
    					document.getElementById("commentbox").innerHTML=xmlHttp.responseText;
    					}
    			showHint();
    			} 
    	} 
    
    function GetXmlHttpObject()
    	{ 
    	var objXMLHttp=null;
    	if (window.XMLHttpRequest)
    			{
    			objXMLHttp=new XMLHttpRequest()
    			}
    		else if (window.ActiveXObject)
    			{
    			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    			}
    	return objXMLHttp
    	} 
    showHint();

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know why it doesn't work in IE
    1 ) What are your expected results and what are the actual results?

    2) Did you put alerts in your code at each crucial step to help you locate the spot where things go wrong?

  3. #3
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) on firefox everything went well, it refreshed the data every few seconds. on IE, it just doesnt do anything, as if there is no script.

    2) I tried that, but IE wont budge, no matter where I put any alerts it doesn't do anything (even before the function call)

  4. #4
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I restarted and it works (a loop that sends requests over and over again), but it aborts after like the 4-7th try, it just stops showing the alerts


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •