garymgordon
Programmer
I have a script that uses Javascript that is shown below, that was written by another Tek-Tips Programmer named jemminger. (Thanks for his help on that. He was great!!)
But, I also now need to know how to basically get the exact same effect ... but using ASP (instead of Javascript) .. so the script can verify the dates and times (as you'll see below) - by looking at the server instead of the client's machine.
So, I need someone's help in re-writing this using ASP so it will accomplish the exact same task of sending a user to one page if it is BEFORE a particular date and time, then to another page if it is DURING a particular set of dates and times, and then to another page if it is AFTER the expiration date.
If someone can help me, I would greatly appreciate it.
Thanks,
Gary
HERE'S THE CURRENT JAVASCRIPT that needs to be converted to an ASP script:
==============================
<html>
<head>
<script language="javascript">
<!--
var expireYear = "2002";
var expireMonth = "12";
var expireDay = "29";
var liveYear = "2002";
var liveMonth = "12";
var liveDay = "27";
var dateLive = new Date(liveMonth+'-'+liveDay+'-'+liveYear);
var dateExpire = new Date(expireMonth+'-'+expireDay+'-'+expireYear);
function checkDate() {
var now = new Date();
var hh = now.getHours();
var dd = now.getDate();
var bLive = false, bExpire = false;
if (dd >= liveDay) {
if (dd > liveDay || hh >= 9) {
bLive = true;
}
}
if (!bLive) {
location.href = "page1.html";
}
if (dd >= expireDay) {
if (dd > expireDay || hh >= 9) {
bExpire = true;
location.href = "page3.html";
}
}
if (bLive && !bExpire) {
location.href = "page2.html";
}
}
//-->
</script>
</head>
<body onload="checkDate();">
</body>
</html>
====================
Please help me if you can.
Thanks,
Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
But, I also now need to know how to basically get the exact same effect ... but using ASP (instead of Javascript) .. so the script can verify the dates and times (as you'll see below) - by looking at the server instead of the client's machine.
So, I need someone's help in re-writing this using ASP so it will accomplish the exact same task of sending a user to one page if it is BEFORE a particular date and time, then to another page if it is DURING a particular set of dates and times, and then to another page if it is AFTER the expiration date.
If someone can help me, I would greatly appreciate it.
Thanks,
Gary
HERE'S THE CURRENT JAVASCRIPT that needs to be converted to an ASP script:
==============================
<html>
<head>
<script language="javascript">
<!--
var expireYear = "2002";
var expireMonth = "12";
var expireDay = "29";
var liveYear = "2002";
var liveMonth = "12";
var liveDay = "27";
var dateLive = new Date(liveMonth+'-'+liveDay+'-'+liveYear);
var dateExpire = new Date(expireMonth+'-'+expireDay+'-'+expireYear);
function checkDate() {
var now = new Date();
var hh = now.getHours();
var dd = now.getDate();
var bLive = false, bExpire = false;
if (dd >= liveDay) {
if (dd > liveDay || hh >= 9) {
bLive = true;
}
}
if (!bLive) {
location.href = "page1.html";
}
if (dd >= expireDay) {
if (dd > expireDay || hh >= 9) {
bExpire = true;
location.href = "page3.html";
}
}
if (bLive && !bExpire) {
location.href = "page2.html";
}
}
//-->
</script>
</head>
<body onload="checkDate();">
</body>
</html>
====================
Please help me if you can.
Thanks,
Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer