【发布时间】:2015-09-19 05:09:00
【问题描述】:
我有以下代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript" language="javascript">
$( function() {
window.onload = function () {
alert('This page was just hidden:');
}
});
</script>
</head>
<body pageshow="alert('Done');">
<div id="mypage" data-role="page" data-theme="b">
<div data-role="header">
<h1>Page 2</h1>
</div>
<div data-role="content">
<p>This is page 2.</p>
</div>
</div>
</body>
</html>
但pageShow 事件未在 IE 中触发。知道为什么吗?
【问题讨论】:
-
你什么时候打电话给
pageShow?什么是pageShowevent? -
您是否仅在 Firefox 中运行此页面?
-
不,我也必须在 ie 中运行它。
-
因此该命令仅适用于 FF。只需使用 onload - 或者因为您使用的是 jQuery,所以使用 jQuery 加载事件...
标签: javascript jquery