I got the below to work in Firefox, but now I need for it to work both in IE and Firefox. Please, help me figure what what I need to add to get it to work with IE too. Thanks! <html> <head><title></title> <script type='text/javascript'> var dc = new Array('59.151.21.100','64.233.161.18','64.233.161.81','64.233.161.84','64.233.161.147','64.233.161.184','64.233.171.44','64.233.171.133','64.233.179.93','64.233.179.184','64.233.185.101','64.233.187.84','64.233.189.161','66.102.1.44','66.102.7.83','66.102.9.147','66.102.11.115','66.249.81.80','66.249.81.184','66.249.83.19','66.249.83.107','66.249.89.133','66.249.89.184','66.249.91.44','66.249.91.80','66.249.93.81','66.249.93.83','72.14.205.99','72.14.207.100','72.14.207.184','72.14.209.19','72.14.209.84','72.14.211.44','72.14.211.83'); var url = 'www.soundandshape.net'; </script> <script type='text/javascript'> var dc_count = 1; var http_request = new Array(); var handled = new Array(); function makeRequest(url, i) { http_request[i] = new XMLHttpRequest(); if (!http_request[i]) { return false; } http_request[i].onreadystatechange = handleResponse; http_request[i].open('GET', url, true); http_request[i].send(null); return true; } function handleResponse() { var nr = -1; for (var i = 0; i < dc_count; ++i) { if ( (handled[i] != true) && http_request[i] && (http_request[i].readyState == 4) && (http_request[i].status == 200)) { nr = i; break; } } if (nr != -1) { var pr = http_request[nr].responseText; handled[nr] = true; updatePR(pr); if(pr == 0) { document.getElementById('datacenters').innerHTML = document.getElementById('datacenters').innerHTML + "<br />" + dc[i]; } } else { // alert('nr = -1') } } function updatePR(pr) { var minus = parseInt(document.getElementById('count').innerHTML); document.getElementById('count').innerHTML = parseInt(minus) - 1; var prev = parseInt(document.getElementById('pr'+pr).innerHTML); document.getElementById('pr'+pr).innerHTML = parseInt(prev) + 1; //timer = setInterval('starter()', 100); } </script> </head> <body> <h1>Live Pagerank</h1> <br><br> <div id="count"></div> <form method="GET" action="#"> <input type="text" name="url" size="20"><input type="submit" value="Submit" name="B1"> </form> <table width='500' border='1' cellspacing='0' cellpadding='0'> <tr> <td align='center'>-1</td> <td align='center'>0</td> <td align='center'>1</td> <td align='center'>2</td> <td align='center'>3</td> <td align='center'>4</td> <td align='center'>5</td> <td align='center'>6</td> <td align='center'>7</td> <td align='center'>8</td> <td align='center'>9</td> <td align='center'>10</td> </tr> <tr> <td id="pr-1" align='center'>0</td> <td id="pr0" align='center'>0</td> <td id="pr1" align='center'>0</td> <td id="pr2" align='center'>0</td> <td id="pr3" align='center'>0</td> <td id="pr4" align='center'>0</td> <td id="pr5" align='center'>0</td> <td id="pr6" align='center'>0</td> <td id="pr7" align='center'>0</td> <td id="pr8" align='center'>0</td> <td id="pr9" align='center'>0</td> <td id="pr10" align='center'>0</td> </tr> </table> <script type='text/javascript'> var x = 0; var upto = 15; document.getElementById('count').innerHTML = parseInt(dc.length); var dc_count = dc.length; function starter() { // clearInterval(timer); if(x <= dc_count) { for (var i = x; i < x+upto; i++) { if(i == dc_count) { break; clearInterval(timer); } //var prev = parseInt(document.getElementById('pr0').innerHTML); //document.getElementById('pr0').innerHTML = parseInt(prev) + 1; makeRequest('dc.php?url='+url+'&dc='+dc[i], i); } x = i; } } timer = setInterval('starter()', 1000); </script> <div id="datacenters"> </div> <!--// 64.233.183.* 72. 14.203.* //--> </body></html> Code (markup):
I read a lot of posts on this and other forums that say something "works in Firefox but not IE". It is a flawed way of programming to create something that works in a browser only 15% of internet users have (Firefox) instead of designing for what almost 80% of internet users have (IE). ( If you don't believe me see the stats for yourself: http://marketshare.hitslink.com/report.aspx?qprid=0 ) I agree, Firefox is a far better browser, but unfortunately not everyone knows that yet. So you have to see it as, if it doesn't work in IE, it doesn't work. If you start by programming for Firefox, you will end up debugging endlessly for IE, but if you start by programming for IE, and your designs will usually work in Firefox too.
Ha, if it was meant to be used for the mass's then I would, but it is a tool I coded for personal use and I use firefox. So, yeah sure, but thanks for no help really. I figured it out anyhow. I just hoped I could get some quick help here instead of spending a hour on it myself. <3's It was simple. Just added this to the code. if(window.XMLHttpRequest && !(window.ActiveXObject)) { http_request[i] = new XMLHttpRequest(); } else if(window.ActiveXObject) { try { http_request[i] = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { http_request[i] = new ActiveXObject("Microsoft.XMLHTTP"); } } Code (markup): .