I have this page for tracking accidents and would like to have the "Number of days since last accident" and Number of days since last recordable" to add a new day to the count each day that references "Date of last accident" and "Date of last recordable" using the computers clock. This was as each day passes the information is always up to date. How could I do this. Here's the Page:
<[EMAIL PROTECTED]"JAVASCRIPT" CODEPAGE="1252"%> <!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"> <head> <title>PWT Accident Stats</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> <!-- body,td,th { color: #000000; } body { background-color: #CCCCCC; } a:link { color: #0000FF; } a:visited { color: #FF00FF; } a:hover { color: #FF0000; } --> </style></head> <body> <FORM> <br/> <table width="406" height="66" border="3" cellpadding="3" cellspacing="3"> <tr> <td width="199"><strong>Date of last accident:</strong> </td> <td width="186"><input name="DOLA" onchange="doCalc(this);"/> </td> </tr> <tr> <td><strong>Date of last recordable:</strong> </td> <td><INPUT Name="DOLR" onChange="doCalc(this);"> </td> </tr> </table> <hr /> <table width="407" height="63" border="3" cellpadding="3" cellspacing="3"> <tr> <td width="283"><div align="left"><strong>Number of days since last accident </strong></div></td> <td width="93"> <div align="center"><SPAN ID="S_DOLA">[no date yet]</SPAN> </div></td> </tr> <tr> <td width="283"><strong>Number of days since last recordables:</strong> </td> <td><div align="center"><SPAN ID="S_DOLR">[no date yet]</SPAN> </div></td> </tr> </table> <p><br/> </FORM> <SCRIPT Language="JavaScript"> function doCalc(fld) { var sp = document.getElementById("S_"+fld.name); var when = new Date( fld.value ); if ( isNaN(when) ) { sp.innerHTML = "<font color=red><b>INVALID DATE ENTERED</b></font>"; fld.value = ""; fld.focus( ); return; } var now = new Date( ); var today = new Date( now.getFullYear(), now.getMonth(), now.getDate() ); var then = new Date( when.getFullYear(), when.getMonth(), when.getDate() ); var diff = today.getTime() - then.getTime(); var diffdays = diff / ( 24*60*60*1000 ); // div by milliseconds per day sp.innerHTML = "<b>" + diffdays + "<b>"; } </SCRIPT> </body> </html> ------------------------ Yahoo! Groups Sponsor --------------------~--> AIDS in India: A "lurking bomb." Click and help stop AIDS now. http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
