寻找在特定时段和星期几显示div的解决方案。 我已经找到了一些东西,但我不知道如何修改它以显示特定日期和时间的HTML内容: - 周一至周四的10:00至22:30 - 周五至周六的10:00至24:30 - 周日,11:00-21:30
<script type="text/javascript">
function ShowOnTime(from, to, element){
var a = new Date();
var now = a.getHours(); //local hours. For GMT use .getUTCHours()
if( now < from || now > to ){
$(element).html("<br><h4>We are currently unable to process this order. </ h4> <p> Order can be placed only in: <ul><li>Monay - Thursday, from 10:00 to 22:30 </li> <li>Friday - Saturday, from 10:00 to 24:30 </li> <li> Sunday, from 11:00 to 21:30</li></ul>");
}else{
$(element).show();
}
}
$(document).ready(function(){
ShowOnTime(12,24,"#hide");
});
</script>
<div id="hide">
<div>
Link to proceed order, is visible only on specific hours and day of the week</div>
</div>