【代码】html域名跳转代码以及网站js多域名跳转
<!--将以下的 www.college-ing.com 改成你要跳转的域名-->
第一种:单域名的跳转
1、域名在服务器端跳转
1 Response.Redirect(http://www.college-ing.com) 2 Response.End
2、如果你的域名要在客户端跳转,可以这样:
1 2 3 | <script language= "javascript" type= "text/javascript" > window.location= "http://www.college-ing.com" ; </script> |
3:如果你要让域名页面显示几秒钟之后跳转,可以在html代码的<head></head>部分加上这样的域名跳转代码:
<meta http-equiv="refresh" content="3; url=http://www.college-ing.com">
以上三种是也比较常见,比较常用的免费域名跳转代码运行平台Win9x WinNT Win2000 WinME WinXP。
4:不隐藏域名跳转之后的地址
1 <html> 2 <body> 3 <meta http-equiv="refresh" content="0.1;url=www.college-ing.com"> 4 </body> 5 </html>
5:可隐藏域名跳转之后的地址:
<html> <frameset framespacing="0" border="0" rows="0" frameborder="0"> <frame name="main" src="www.college-ing.com" scrolling="auto" noresize> </frameset> </html>
6:定时的域名跳转代码
<meta http-equiv="refresh" content="3;rul=http://www.college-ing.com">
此代码可以让网页在一定的时间内,跳转到另外一个网页上,其中content=" 为跳转前停暂的秒数,rul= 为跳转的域名。
第二种:多域名的跳转
<script>try {if( self.location == "http://www.college-ing.com/jsjq" ) { top.location.href = "http://域名一/目录"; } else if( self.location == "http://域名二/" ) { top.location.href = "http://域名二/目录"; } else if( self.location == "http://域名三/" ) { top.location.href = "http://域名三/目录"; } else if( self.location == "http://域名四/" ) { top.location.href = "http://域名四/目录"; } else {document.write ("错误的访问地址")}} catch(e) {}</script>
多域名跳转完整示例:(以下域名为例子,可替换成你需要跳转的网站)
<!DOCTYPE HTML> <!-- -头部页面描述:START --> <!DOCTYPE html PUBLIC "" ""> <HTML lang="en"> <HEAD> <META charset="UTF-8"> <TITLE>我的大学</TITLE> <script>try {/* college-ing.com */ if( self.location == "www.college-ing.com" ) { top.location.href = "/jsjq/"; // 这里跳转到目录} else if( self.location == "http://www.gzlongtengfei.com/" ) { top.location.href = "/zt/"; } else if( self.location == "http://www.eduzhinan.cn/" ) { top.location.href = "http://www.college-ing.com/"; } else if( self.location == "http://www.eduzhinan.com/" ) { top.location.href = "/siwei/"; } else if( self.location == "http://www.365younger.com/" ) { top.location.href = "/coordinates/"; } else if( self.location == "http://www.younger-e.com/" ) { top.location.href = "/xiuxian/"; } else if( self.location == "http://www.gaoqiwenda.com/" ) { top.location.href = "/fudao/"; }else if( self.location == "https://www.2025nian.com/" ) { top.location.href = "/ideas/"; } else if( self.location == "https://www.8090nian.com/" ) { top.location.href = "/9you/"; } else if( self.location == "http://www.8848gt.cn" ) { top.location.href = "http://www.8848gt.com/"; } else if( self.location == "http://www.527haixian.com/" ) { top.location.href = "http://www.yulizhai.cn/"; } else { var str = server.htmlEncode("<p><ahref='http://college-ing.com'>我的大学</a></p>"); document.write(str);//document.write ("错误的访问地址")} } catch(e) {}</script> </HEAD> </HTML>
以上根据自己所需添加
else if( self.location == "域名1" ) { top.location.href = "域名2"; }
声明:本网站为“个人非营利性”网站,仅是博主与热心网友收集整理提供的经验记录和学习内容!本站文章图片来源于网络,如若本站图片侵犯了原著者的合法权益,可联系本站删除。
网站初心:一些棘手的、偏门的问题,能比较方便地在一个网站上查询、解决。如能帮到你的,可以在文章结尾赞赏一下,维持网站日常维护!谢谢