I am pretty sure my problem is I am using some kind of IE-specific calls because it's not working in firefox. Firefox shows no errors, but it doesn't do anything.
I am thinking it does like the way I did the interval thing. Is setInterval not a valid javascript call?
It functions correctly in IE and has no errors in firefox, so I am suspicious of that interval call.
I have the code here:
Expand|Select|Wrap|Line Numbers
- function createRequestObject()
- {//creates an httprequest object
- var ro;
- var browser = navigator.appName;
- if(browser == "Microsoft Internet Explorer"){
- ro = new ActiveXObject("Microsoft.XMLHTTP");
- }else{
- ro = new XMLHttpRequest();
- }
- return ro;
- }
- function returnObjById( id )
- {
- if (document.getElementById)
- var returnVar = document.getElementById(id);
- else if (document.all)
- var returnVar = document.all[id];
- else if (document.layers)
- var returnVar = document.layers[id];
- return returnVar;
- }
- var http = createRequestObject();
- var scriptlocation="/refresh.cgi";
- var ourinterval=setInterval("SendUpdate()",5000);
- function SendUpdate()
- {
- var action="DATETIME&TEMPERATURE&HUMIDITY&SAMPLESTATE";
- action+="&CHAN1&CHAN2&CHAN3&CHAN4&CHAN5&CHAN6&CHAN7&CHAN8&CHAN9&CHAN10";
- http.open('get', '/refresh.cgi?'+action+'&time='+ new Date().getTime());
- http.onreadystatechange = handleSendUpdateReponse;
- http.send(null);
- }
- function handleSendUpdateReponse()
- {
- if(http.readyState == 4)
- {
- var response = http.responseText;
- var update = new Array();
- if ((response!="")&&(http.status=="200"))
- {
- if(response.indexOf('|' != -1))
- {
- update=response.split('|');
- if (update.length>0)
- {
- if (update[1].indexOf("SUCCESS")>-1)
- {
- var line=update[1];
- var things=new Array();
- things=line.split('&');
- var i;
- for (i=0;i<things.length;i++)
- {
- var nameval=things[i].split('=');
- if (i>0)
- {
- returnObjById(nameval[0]).innerHTML=nameval[1];
- }
- }
- }
- else
- {
- }
- }
- }
- else
- {
- }
- }
- else
- {
- //clearInterval(ourinterval);
- }
- }
- }