js中window.location.href另起一頁面進行url跳轉
window.open( "http://www.baidu.com", "_blank");
附帶定時打開網頁js代碼:
<html>
<head>
<script language="javascript" type="text/javascript">
var h = 13;//定時打開的時
var m = 53;//定時打開的分
var s = 10;//定時打開的秒;
function gogo(){
window.setInterval("runit()",1000);
}
function runit(){
var date = new Date();
var hour = date.getHours();
var mint = date.getMinutes();
var secd = date.getSeconds();
if(hour == h && mint == m && secd == s)
window.open( "http://www.baidu.com", "_blank");
}
</script>
</head>
<body onload="return gogo();">
</body>
</html>
年月日 定時
var m = 4;//
var d = 29;//
var y = 2009;//
function gogo()
{
window.setInterval("runit()",1000);
function runit()
var newnewdata = new Date();
var date = newdata.getDate();
var month = newdata.getMonth()+1;
var year = newdata.getFullYear();
if (month == m && date == d && year == y)
window.location.href = ' http://www.163.com';
</HEAD>
<BODY onload="return gogo();">
</BODY>
本文轉自許琴 51CTO部落格,原文連結:http://blog.51cto.com/xuqin/1176253,如需轉載請自行聯系原作者