View Full Version : Code to display a message if executed after a certain date?
Hi,
I want to put a time limit on accessing certain pages of an internal company website. e.g. If a certain date is reached then the user is prompted to contact me for an updated link - rather than possibly viewing out of date information.
I guess what I need is code to do a date check & then either direct the user to the right page or display a message.
Can anyone help please?
If a certain date is reached then the user is prompted to contact me for an updated link - rather than possibly viewing out of date information.This should never be needed. Out-of-date pages you still want to keep around should be archived neatly and replaced. To use a script for this purpose would indicate neglect and bad design by the webmaster (presumably you).
Twey,
I appreciate your comments re keeping things tidy. However, the scenario I'm faced with relates to a number of different users, within my company, accessing the same 'supplier pricing' page(s).
In this specific case, I need to be able to specify a date that creates an event. This event will give certain users (they know who they are!) the option to go to a "head's-up" page with business related rebate info. It's important that this trigger happens when I need it to.
Thanks again, in advance, for your help in suggesting code for this.
Very well.
function checkDateExceeded(expires, func) {
// expires is a string in MM/DD/YYYY format
// func is a function object to call
var now = new Date();
if(now.getTime() >= Date.parse(expires)) func();
}
Thank you - I'll give it a whirl !!
I'll be back soon with another one no doubt .... it's all a far cry from my old days of Modula2, Turbo Pascal & Cobol ... bit I'm getting there! ;)
Cheers,
N.
Actually, I made an error. Edited.
Powered by vBulletin® Version 4.2.2 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.