1.根据时区来区分访客(国内,国外客户)的代码
<html>
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title></title>
</head>
<SCRIPT LANGUAGE="javascript">
var date = new Date();
if(date.toString().indexOf("+0800")>0)
{
//跳到国内
location.href=http://www.xxxx.com/cnwelcom.htm;
}
else
{
location.href="http://www.xxxx.com/enwelcom.htm";
//跳到国外
}</SCRIPT>
</html>
———————————————————————————————————
2.根据计时自动跳转(3秒后自动跳转)
<html>
<head>
<meta HTTP-EQUIV="REFRESH" CONTENT="5;URL=http://www.xxxx.com.cn">
<title>我的网</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div align="left">本站已改版,新网址为www.xxxx.com.cn, 3秒之后将自动跳转至新网址。<br>
如浏览器不能自动跳转,请点击以下<a href="http://www.xxxx.com.cn">链接</a>。
</div>
</body>
</html>
———————————————————————————————————
3.JS实现跳转代码:多域名指向同一空间
<script>try {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 if( self.location == "http://域名四/" ) {
top.location.href = "http://域名四/目录";
}
else {document.write ("错误的访问地址")}} catch(e) {}</script>
———————————————————————————————————
4.js实现页面跳转的几种方式
第一种:
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
alert("返回");
window.history.back(-1);
</script>
第三种:
<script language="javascript">
window.navigate("top.jsp");
</script>
第四种:
<script language="JavaScript">
self.location='top.htm';
</script>
第五种:
<script language="javascript">
alert("非法访问!");
top.location='xx.jsp';
</script>
js使用弹出窗口实现页面跳转的几种方式
第一种:弹出选择框跳转到其他页面
<script language="javascript">
<!--
function logout(){
if (confirm("你确定要注销身份吗?是-选择确定,否-选择取消"))...{
window.location.href="/logout.asp?act=logout"
}
}
-->
</script>
<input type="button" onclick="logout()" value="注销"/>
第二种:弹出提示框跳转到其他页面
<script language="javascript">
<!--
function logout(){
alert("你确定要注销身份吗?");
window.location.href="/logout.asp?act=logout"
}
-->
</script>
<input type="button" onclick="logout()" value="注销"/>
页面自动跳转到其他页面
只需要在页面加入一行代码
<meta http-equiv="Refresh" content="5; url=http://www.itzyw.com" />
其中,content="5; url=http://www.itzyw.com"中的5表示5秒后跳转,可以直接设置为0
该代码多用于用户登陆时的页面跳转
把 onClick="windows.open("Submit.html")"
改成
onClick="window.location.reload('Submit.html');"
window.open('Submit.html')
———————————————————————————————————
