在前端開發(fā)中,我們經(jīng)常需要使用JavaScript來實(shí)現(xiàn)頁面之間的跳轉(zhuǎn)。下面介紹了幾種常見的跳轉(zhuǎn)方法。
復(fù)制代碼<script language="javascript" type="text/javascript"> window.location.href = "jingxuan.do?backurl=" + window.location.href; </script>
復(fù)制代碼<script> window.location.href = 'http://blog.yoodb.com';</script>
復(fù)制代碼<script language="javascript"> alert("返回"); window.history.back(-1);</script>
復(fù)制代碼<a href="javascript:history.go(-1)">返回上一步</a><a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
復(fù)制代碼<input name="前端知音" type="button" value="前端知音" onClick="location.href='login.do'">
復(fù)制代碼<a href="javascript:" onClick="window.open('login.do','','height=500,width=611,scrollbars=yes,status=yes')">新窗口</a>
復(fù)制代碼<head> <!--只刷新不跳轉(zhuǎn) --> <meta http-equiv="refresh" content="5"> <!--定時(shí)跳轉(zhuǎn) --> <meta http-equiv="refresh" content="5;url=index.html"> </head>
以上是幾種常見的使用JavaScript進(jìn)行頁面跳轉(zhuǎn)的方法。根據(jù)具體需求,選擇合適的方法來實(shí)現(xiàn)頁面跳轉(zhuǎn)功能。