TShopping

標題: Javascript返回上一頁--Java學習與輔導 [打印本頁]

作者: woff    時間: 2011-4-7 13:40
標題: Javascript返回上一頁--Java學習與輔導
1. Javascript 返回上一頁 history.go(-1), 返回兩個頁面: history.go(-2);
2. history.back().
3. window.history.forward()返回下一頁
4. window.history.go(返回第幾頁,也可以使用訪問過的URL)
例:
<a href="javascript:history.go(-1);">向上一頁</a>
response.Write("<script language=javascript>")
response.Write("if(!confirm('完成任務?')){history.back();}")
response.Write("</script>")
response.Write("<script language=javascript>history.go(-1);</script>")
<a href="javascript:history.go(-1);">向上一頁</a>
頁面跳轉: onclick="window.location.href='list.aspx'"
P.S.
小技巧(JS引用JS):
<script type=text/javascript>
<!--
if (typeof SWFObject == "undefined") {
document.write('<scr' + 'ipt type="text/javascript" src="/scripts/swfobject-1.5.js"></scr' + 'ipt>');}
//-->
</script>
Javascript刷新頁面的幾種方法:
1    history.go(0)
2    location.reload()
3    location=location
4    location.assign(location)
5    document.execCommand('Refresh')
6    window.navigate(location)
7    location.replace(location)
8    document.URL=location.href
作者: djf3355    時間: 2013-11-14 00:43
不錯,感謝版主
作者: 65526scjhd    時間: 2013-11-14 00:43
拿分走人呵呵,樓下繼續!
作者: sfgj5241    時間: 2013-11-14 00:43
我也來頂一下..  
作者: 霓虹过美    時間: 2014-8-20 11:43


  这是什么?





歡迎光臨 TShopping (http://www.tshopping.com.tw/) Powered by Discuz! X3.2