woff 發表於 2011-4-7 13:40:31

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:30

不錯,感謝版主

65526scjhd 發表於 2013-11-14 00:43:30

拿分走人呵呵,樓下繼續!

sfgj5241 發表於 2013-11-14 00:43:30

我也來頂一下..

霓虹过美 發表於 2014-8-20 11:43:01



这是什么?
頁: [1]
查看完整版本: Javascript返回上一頁--Java學習與輔導