JavaScript實現(xiàn)頁面跳轉(zhuǎn)的方式匯總
在動手做網(wǎng)站時,不可避免的會碰到頁面跳轉(zhuǎn)的問題,新頁面是在當(dāng)前頁面打開呢?還是在新窗口打開呢?是不是需要依據(jù)參數(shù)進(jìn)行跳轉(zhuǎn)呢或者要經(jīng)過用戶確認(rèn)后再跳轉(zhuǎn)呢?等等很多種情況,下面我們來看下常用的一些JS實現(xiàn)頁面跳轉(zhuǎn)的方式例子。
按鈕式:
<INPUT name="pclog" type="button" value="GO" onClick="location.>
鏈接式:
<a href="javascript:history.go(-1)">返回上一步</a> <a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
直接跳轉(zhuǎn)式:
<script>window.location.;</script>
開新窗口:
<a href="javascript:" onClick="window.open('http://www.ddhbb.com/blog /guestbook.asp','','height=500,width=611,scrollbars=yes,status=yes')"& gt;布丁 足跡 </a>
第一種:
<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>
=====j(luò)avascript中彈出選擇框跳轉(zhuǎn)到其他頁面=====
<script language="javascript"> <!-- function logout()...{ if (confirm("你確定要注銷身份嗎?是-選擇確定,否-選擇取消"))...{ window.location.href="logout.asp?act=logout" } } --> </script> =====j(luò)avascript中彈出提示框跳轉(zhuǎn)到其他頁面===== <script language="javascript"> <!-- function logout()...{ alert("你確定要注銷身份嗎?"); window.location.href="logout.asp?act=logout" } --> </script>
以上內(nèi)容是小編給大家介紹的JavaScript實現(xiàn)頁面跳轉(zhuǎn)的方式匯總,希望對大家有所幫助,也希望大家多多關(guān)注腳本之家網(wǎng)站!
相關(guān)文章
基于JavaScript實現(xiàn)類似于百度學(xué)術(shù)高級檢索功能
這篇文章主要介紹了基于JavaScript實現(xiàn)類似于百度學(xué)術(shù)高級檢索功能 的相關(guān)資料,需要的朋友可以參考下2016-03-03js數(shù)組常用操作方法小結(jié)(增加,刪除,合并,分割等)
這篇文章主要介紹了js數(shù)組常用操作方法,結(jié)合實例總結(jié)了javascript數(shù)組的增加、刪除、合并、分割等操作技巧,需要的朋友可以參考下2016-08-08JavaScript數(shù)值數(shù)組排序示例分享
在Javascript中我們已知有兩個可以直接用來進(jìn)行數(shù)組排序的方法reverse()和sort()。其中reverse()是按照反向?qū)τ跀?shù)組進(jìn)行排序的,而sort()是按照正向進(jìn)行排序的。2014-05-05微信小程序中button去除默認(rèn)的邊框?qū)嵗a
這篇文章主要介紹了微信小程序中button去除默認(rèn)的邊框的實例代碼,代碼簡單易懂,非常不錯,具有一定的參考借鑒價值 ,需要的朋友可以參考下2019-08-08