IE使用onbeforeunload事件的注意事项

在 网页里面使用了下面 onbeforeunload事件。

[code lang=”html”]
<body onbeforeunload="return ‘Are you sure want to exit the game?’;" onContextMenu="return false;" bgcolor="black">
[/code]

在页面中又用到了一些js

需要注意一下几点:

点我一下 改成BUTTON 可以解决 A标签触及 onbeforeunload
点我一下 改成BUTTON 可以解决
点我一下 这样的就不会触及 onbeforeunload

简单的说就是 如果ie里面带有onbeforeunload事件,你点击某个a标签执行js的时候,不能放在href里面出发。不然会弹出 onbeforeunload。 这并不是你想要的。