View Full Version : Time on page alert.


J E P P O
04-03-2003, 09:02 PM
hey every1,

ive recently put up a page with a time on page alert but it doesn't seem to be workin. The page im working on is here (http://www.geocities.com/jeppo_world/sluggo/intelligence.html)

And heres the source:

<html>
<head>
<title>Intelligence Test</title>

<style>
BODY { scrollbar-3d-light-color:red;
scrollbar-arrow-color:red;
scrollbar-base-color:#ff6600;
scrollbar-dark-shadow-color:red;
scrollbar-face-color:#ff9900;
scrollbar-highlight-color:#ff6600;
scrollbar-shadow-color:red}
</style>

<script language="JavaScript">

function blockError(){return true;}

window.onerror = blockError;

</script>

<SCRIPT>
// Provided free at http://www.lissaexplains.com

<!--

var onHours = " ";

var onMinutes = " ";

var onSeconds = " ";

var offHours = 0;

var offMinutes = 0;

var offSeconds = 0;

var logSeconds = 0;

var logMinutes = 0;

var logHours = 0;

var OnTimeValue = " ";

var OffTimeValue = " ";

var PageTimeValue = " ";

// Back to previous page.

function WinOpen()

{

getLogoffTime();

}

// Loads HTML page to full window for View Source.

function WinOpen1()

{

alert('\nPage will load to full screen.\n\nUse View/Document Source from menu bar to view source.\n\nClose new window to return to this page. ');

window.open("js-timer.htm","DisplayWindow","menubar=yes,scrollbars=yes");

window.open("js-timer.htm","DisplayWindow","menubar=yes,scrollbars=yes");

}


// Captures logon time.

function getLogonTime()

{

var now = new Date();

// Used to display logon time.

var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."

var Hours = now.getHours();

Hours = ((Hours > 12) ? Hours - 12 : Hours);

var Minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();

var Seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();

// String to display log-on time.

OnTimeValue =(" "

+ Hours

+ Minutes

+ Seconds

+ " "

+ ampm);

// Capture logon time for use in timer().

onHours = now.getHours();

onMinutes = now.getMinutes();

onSeconds = now.getSeconds();

}

function getLogoffTime()

{

var now = new Date();

// Used to display logoff time.

var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."

var Hours = now.getHours();

Hours = ((Hours > 12) ? Hours - 12 : Hours);

var Minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();

var Seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();

// String to display log-off time.

OffTimeValue =(" "

+ Hours

+ Minutes

+ Seconds

+ " "

+ ampm);

// Capture logoff time for use in timer().

offHours = now.getHours();

offMinutes = now.getMinutes();

offSeconds = now.getSeconds();

timer();

}

// Compute difference between logoff time and logon time.

function timer()

{

if (offSeconds >= onSeconds)

{ logSeconds = offSeconds - onSeconds; }

else

{

offMinutes -= 1;

logSeconds = (offSeconds + 60) - onSeconds;

}

if (offMinutes >= onMinutes)

{ logMinutes = offMinutes - onMinutes; }

else

{

offHours -= 1;

logMinutes = (offMinutes + 60) - onMinutes;

}

logHours = offHours - onHours;

// Used to display time on page.

logHours = ((logHours < 10) ? "0" : ":") + logHours;

logMinutes = ((logMinutes < 10) ? ":0" : ":") + logMinutes;

logSeconds = ((logSeconds < 10) ? ":0" : ":") +logSeconds;

// String to display time on page.

PageTimeValue =(" "

+ logHours

+ logMinutes

+ logSeconds);

displayTimes();

}

function displayTimes()

{

alert("Thank you for visiting my Site\ \nLOG ON TIME : " +OnTimeValue+"\n\nLOG OFF TIME : "+OffTimeValue+"\n\nTIME ON PAGE : " + PageTimeValue);

}

// -->

</SCRIPT>

</head>

<body onUnLoad="WinOpen()" onLoad="getLogonTime()"; background="http://www.geocities.com/jeppo_world/MyPics/rainbow.jpg" marginwidth="0" marginheight="0">
<center>
<font face="comic sans ms" size=5><b>Are you a Genius or just plain stupid? Take the test and find out!</b></font><p>
</center>
<center>
<table width="200" height="200" bgcolor="#D3D3D3" border="1" bordercolor="#FFFFFF">
<tr>
<td width="200" height="200" bgcolor="#D3D3D3" align="center" valign="middle">
<marquee align="middle" width="75%" height="25" behavior="alternate" scrolldelay="10"><font color="#000000">Loading...
</marquee>
</td>
</tr>
</table>
</center>
</body>
</html>