当前位置:沸点梦工场 > 网页设计教程 > JavaScript教程 > 浏览文章

常用javascript跳转代码

互联网 2007年09月21日 【字体:
     按钮式:

  <INPUT name="pclog" type="button" value="GO" onClick="location.href='http://xxxx.cn/'">

  链接式:

  <a href="javascript:history.go(-1)">返回上一步</a>

  <a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>

  直接跳转式:

  <script>window.location.href='http://www.xxxx.cn';</script>

  开新窗口:

  <a href="javascript:" onClick="window.open('http://www.xxxx.html','','height=500,width=611,scrollbars=yes,status=yes')">奉天承运</a>

     自动跳转:

<html>
<head>
<title>newpaeg</title>
</head>
<script language='Javascript'>
function go(){
window.location="http://www.sohu.com";  //跳转到http://www.sohu.com页面,转至同一目录还是其它网页看你给的地址了
}
setTimeout("go()",5000);
/5秒钟后执行go()
}
</script>
<body>
</body>
</html>