Link to home
Start Free TrialLog in
Avatar of Bamaby39
Bamaby39

asked on

html links active at certain times only

I have a list of classes and I want the "view" button link to only be active at certain times during the day for each class.  For non-active links, I need an alternate button that is not live.  The class time is listed in the table view and I would like to use that as the variable for activating the links.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bamaby39
Bamaby39

ASKER

Thanks Ray.  
The times need to be client browser since we have clients in multiple time zones.  The view button would be active for an hour or hour and a half at most and should be unaffected by user clicks.  Background:  All the view button does is link to a live streaming video page for a fitness class.  So there will be about 7 classes listed with one active link that moves down the page as time passes.  
Good point on refresh so it would be ideal if the page auto refreshed when the view button changed.
Avatar of Vimal DM
Hi,

Am not very clear about your requirement may be the below script can help you,

function ShowHide()
{
  var d = new Date();
  var dayofweek = d.getDay();
  var hourofday = d.getHours();
  if ((dayofweek === 0 && hourofday <= 7) || dayofweek === 6 || (dayofweek === 5 && hourofday >= 16))
  {
    $("#hello a").click(function(e){
    e.preventDefault();});
  }
}
$(document).ready(function(){
    ShowHide();
});