I have only dabbled in Javascript. I cobbled this code together from articles I have read on line and got it working with the exception of the "document.write()" enclosed below. All other document.writes in this web page work fine, but I do not understand why this one misbehaves. It fires, so the logic is working, but once the entire page has displayed properly, the page is instantly overwritten with a blank white page with the contents of the document.write in the upper left corner and the browser churns endlessly (not hung) with a "waiting for host" message in the footer.
Obviously there is something about this XMLHttpRequest() environment that I don't know about. How do I get the document.write() function to write the text into the table cell inline, conditionally?
Obviously there is something about this XMLHttpRequest() environment that I don't know about. How do I get the document.write() function to write the text into the table cell inline, conditionally?
Code:
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>
<TR>
<TD>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide script
if (!xmlHttp==false) {
xmlHttp.open("HEAD","AfricanChickenWings.html",true);
xmlHttp.onreadystatechange=function() {
if (xmlHttp.readyState==0 || xmlHttp.readyState==4) {
var dPage = new Date(xmlHttp.getResponseHeader("Last-Modified"));
dPage = dPage.getTime();
if ((dToday -dPage) /1000 /60 /60 /24 <90)
{
document.write('<FONT SIZE="-2" COLOR="#FF0000">New</FONT>');
}
}
}
xmlHttp.send(null)
}
// hide script End -->
</SCRIPT>
</TD>
</TR>
</TABLE>