<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://example.com/' target='_blank' rel='nofollow'><img src='http://example.com/skin/cmsmoban/images/logo.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
-
21 点到次日 6 点显示广告 3