实现不同时段跳转不同页面
2008-03-29 15:39:21代码如下:
<script>
var h=(new Date()).getHours();
if (h>=6 && h<18){
location.href=’http://www.google.com’
//白天上google
}
else{
location.href=’http://www.baidu.com’
//晚上上百度
}
</script>
有人使用这样的:
<script>
var h=(new Date()).getHours();
if (h>=6 && h<18){
navigate(’http://www.google.com’)
//白天上google
}
else{
navigate(’http://www.baidu.com/’)
//晚上上百度
}
</script>
但是navigate不被firefox支持