schme16 Posted May 9, 2007 Share Posted May 9, 2007 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! Quote Link to comment Share on other sites More sharing options...
fenway Posted May 9, 2007 Share Posted May 9, 2007 I don't have the time to "dissect" it -- which lines aren't worknig? Quote Link to comment Share on other sites More sharing options...
schme16 Posted May 10, 2007 Author Share Posted May 10, 2007 thats the problem, i dont know, it all works in firefox...its not 'including' the file every timer tick, it just stays the same (calls it once and no more) Quote Link to comment Share on other sites More sharing options...
fenway Posted May 10, 2007 Share Posted May 10, 2007 Well, lace the function with alert()s, and see where it stops. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.