Re: [ js ] firefox body onload 使用 window.hist …

看板Ajax作者 (多想兩分鐘 = =")時間16年前 (2009/03/24 00:03), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
無聊測了一下,原po的html複製一份直接開, 在 IE7是可以動的(但它還是囉嗦的問要不要執行script), 在火狐狸無效。 2.htm 改這樣↓ <html> <body onload="window.history.back();" onmousemove="window.history.back();"> </body> </html> 滑鼠移動也會回上一頁,所以,應該是瀏覽器為了安全性之類的考量擋掉了…吧。 ※ 引述《cutecpu (可愛中央處理器)》之銘言: : 我做了 2 個網頁,分別是 : 1.htm,內容是: : <html> : <body> : <a href="2.htm">2</a> : </body> : </html> : 2.htm,內容是: : <html> : <body onload="window.history.back();"> : </body> : </html> : ------------------分隔線,問題如下------------------- : 我打開 1.htm,點了 2.htm 的連結後,為什麼 window.history.back()沒有產生作用?? : 而且好像只有 window.history.back()放在onload會失效,如果我放入其它函式,如 : alert('hi'); 之類的就可以 work。請問有人知道為什麼嗎,謝謝^_^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.229.207.119

03/24 00:09, , 1F
謝謝唷^_^
03/24 00:09, 1F
文章代碼(AID): #19nxBYrJ (Ajax)
文章代碼(AID): #19nxBYrJ (Ajax)