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>
年月日 定时
- <script language="javascript" type="text/javascript">
- 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';
- }
- }
- </script>
- </HEAD>
- <BODY onload="return gogo();">
- </BODY>
本文转自许琴 51CTO博客,原文链接:http://blog.51cto.com/xuqin/1176253,如需转载请自行联系原作者