不同时间显示不同的广告代码

admin 2024年1月19日13:44:40帝国cms技巧评论1,175 次浏览阅读模式

内容摘要

<script type="text/javascript">var h = new Date().getHours();var t = "";if(h >= 7 && h <= 13){ t = "<div class='inde_t_ad'><a href='http://ww

文章正文

<script type="text/javascript">var h = new Date().getHours();var t = "";if(h >= 7 && h <= 13)
{        t = "<div class='inde_t_ad'><a href='http://www.daixiao360.cn/' target='_blank' rel='nofollow'>
<img src='http://anyun.org/wp-content/uploads/2024/01/20240113152814-98.png' border='0' /></a></div>";        }
else if(h >= 14 && h <= 20){        t = "广告2";}  
else if(h >= 21 || h <= 6){        t = "广告3";  }document.getElementById('time_ads').innerHTML = t;</script>

注释:

早7点到13点显示广告1

14点到20点显示广告2

19点到次日6点显示广告3

代码注释

相关文章
weinxin
我的微信
微信扫一扫
admin
  • 本文由 发表于 2024年1月19日13:44:40
  • 转载请务必保留本文链接:https://anyun.org/a/webtips/ecmstips/2024/0119/17764.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: