...

View Full Version : IE works from C: but not from internet



cec energy
04-28-2008, 07:54 PM
www.cecenter.org

I made a very simple ticker to approximate how much energy we have saved our clients. It works fine when I tested it just from the C drive. When I put it on the site it worked fine on FF but not IE. In fact, IE would load half the site and then say that it could not load the site, and then give an error page. If I hit "refresh" the site then shows up properly. Very strange?

It is particularly confusing because it will give an error every-other-time that I reload the page.

Here is my code:


<script type="text/javascript">
function doSomething()
{
var allsecs = new Date()
var time = allsecs.getTime()
var timeadjust = time - 1166832000000;
moneysaved = 270000000 + .000475647 * timeadjust;
moneysaved = moneysaved.toFixed(2);

var sRegExp = new RegExp('(-?[0-9]+)([0-9]{3})');
while(sRegExp.test(moneysaved))
{
moneysaved = moneysaved.replace(sRegExp, '$1,$2');
}

document.getElementById("numchange").innerHTML = moneysaved;
}

setInterval ("doSomething()" , 1000 );
doSomething();

</script>

This is the doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

Anyone have any ideas?

mjlorbet
04-28-2008, 08:02 PM
change


setInterval ("doSomething()" , 1000 );
doSomething();setInterval ("doSomething()" , 1000 );
doSomething();

to


window.onload = function(){setInterval("doSomething()", 1000);};

and see if the results are different. if they are (and it works) then you've found a glitch in the ie js parser, basically the extended load time from the server is allowing the script to execute faster than the content is received, possibly causing ie to bug out & go to that message, the reason it would work on the refresh is that the page is already cached but it doesn't recognize this as it hasn't displayed it yet, the following refresh would give an error because it is trying to update content & would find the same problem. if that is the case (which i kind of doubt) then that would fix it for you. if it doesn't work, comment out that line, re-upload, clear your cache and visit the site again. if the error still occurs it likely has to do with the headers your php is returning and not the script, if it doesn't then ie just doesn't like the body of your function.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum