网站页面直接跳转到别的页面

代码1:

window.location.href='http://m.12345678.cn/';

代码2:

 1 <html>
 2 <head>
 3 <title>正在跳转</title>
 4 <meta http-equiv="Content-Language" content="zh-CN">
 5 <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
 6 <meta http-equiv="refresh" content="5;url=http://www.baidu.com/">
 7 </head>
 8 <body>
 9 </body>
10 </html>

代码3:

 1 <html>
 2 <head><title>正在跳转</title>
 3 </head>
 4 <body>
 5 <script language='javascript'>document.location = 'http://www.baidu.com/'</script>
 6 </body>
 7 </html>
 8 <!--或者在js文件直接加入
 9 document.location = 'http://www.baidu.com/';
10 -->

代码4:

 1 <html>
 2 <head>
 3 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 4 <title>正在跳转</title>
 5 </head>
 6 <body>
 7 <form name=loading> 
 8  <p align=center> <font color="#0066ff" size="2">正在跳转,请稍等</font><font color="#0066ff" size="2" face="Arial">...</font>
 9   <input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#0066ff; background-color:#fef4d9; padding:0px; border-style:none;"> 
10   
11   <input type=text name=percent size=47 style="color:#0066ff; text-align:center; border-medium; border-style:none;"> 
12   <script>  
13 var bar=0  
14 var line="||"  
15 var amount="||"  
16 count()  
17 function count(){  
18 bar=bar+2  
19 amount =amount + line  
20 document.loading.chart.value=amount  
21 document.loading.percent.value=bar+"%"  
22 if (bar<99)  
23 {setTimeout("count()",100);}  
24 else  
25 {window.location = "http://www.baidu.com/";}  
26 }</script> 
27  </p> 
28 </form> 
29 <p align="center"> 如果您的浏览器不支持跳转,<a style="text-decoration: none" href="http://www.baidu.com/"><font color="#FF0000">请点这里</font></a>.</p>
30 </body>
31 </html>

代码4的效果为:

转载请注明出处: 欢迎留言或qq(1090413588)交流
原文地址:https://www.cnblogs.com/linyusong/p/5870755.html