Jump to content

Why doesn't this work


schme16

Recommended Posts

This code works fine in firefox (http://mooseinc.net/chat) but refuses to refresh the page in IE.

the way it works is i have a page where all the database is dumped and i import the data from that file every second. i think it might be to do with the import file script...but i'm not that familia with JS....PLEASE HELP!

 

Heres the code for you guys to disect:

 

 

<SCRIPT LANGUAGE="Javascript">
<!--
var rfNodeId='';
var xmlhttp;

function include(pURL, pNodeId) {
    if (arguments.length!=0) {
        var url=pURL;
        if (arguments.length>=2) {
            rfNodeId=pNodeId;
        }
        getFile(pURL);
        if ((typeof(xmlhttp))!='object') {
            document.write('You need to upgrade your browser to use this page.\r\nAs of March 2006 more than 98% of the web browsers in use support the remote scripting object. Either your browser does not support remote scripting or the support has been disabled.');
        }
    }else{
        if (xmlhttp.readyState==4) {
            if (xmlhttp.status==200) {
                if (rfNodeId=='') {
                    document.write(xmlhttp.responseText);
                }else{
                    document.getElementById(rfNodeId).innerHTML=xmlhttp.responseText;
                }
            }
        }
    }
}

function getFile(pURL) {
var objError=false;
    try {
        if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
            xmlhttp=new XMLHttpRequest();
        }
    }
    catch(e) { objError=true; }
    try {
        if (window.ActiveXObject) { //IE 
            xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
            objError=false;
        }
    }
    catch(f) { objError=true; }

    if (!objError) {
        xmlhttp.onreadystatechange=include;
        xmlhttp.open("GET", pURL, true); // leave true for Gecko
        xmlhttp.send(null);
    }else{ 
        alert('Your browser does not appear to support remote scripting.');
        xmlhttp=false;
    }
}




               var x = 1;
        var y = .5;
	var yes = 'true';
	function startClock(){
        x = x-y;
        document.frm.clock.value = x;
        setTimeout("startClock()", 100);
	    if(x==.5){include('dump.php', 'Chat_window');}

       	if(x==0){include('users.php', 'online'); x=1;}


    

       

 

 

 

 

Thanks in advance!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.