js如何在指定页面跳转到另一指定页面

输入www.a..cn/1.html,直接跳转至 www.b..cn/2.html,请各位大神帮忙,谢谢!

要实现从一个页面A跳到另一个页面B,js实现就在A的js代码加跳转代码

JS跳转大概有以下几种方式:

第一种:(跳转到b.html)
<script language="javascript" type="text/javascript">
window.location.href="b.html";
</script>
第二种:(返回上一页面)
<script language="javascript">
window.history.back(-1);
</script>
第三种:
<script language="javascript">
window.navigate("b.html");
</script>
第四种:
<script language="JavaScript">
self.location=’b.html’;
</script>
第五种:
<script language="javascript">
top.location=’b.html’;
</script>

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-06-27
在第一个html页面中写一个方法
<script type="text/javascript">
function check(){
window.location.href='www.b..cn/2.html'
}
</script>
<body onload="check()">
</body>
第2个回答  2013-06-28
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html debug="true">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body onload='j()'>
</body>

<script>
function j () {
window.location.href='http://www.baidu.com/';
}
</script>本回答被提问者和网友采纳
第3个回答  2013-06-28
<body onload="location.href='http://www.b..cn/2.html'"></body>