javascript中的pageShow事件 [英] pageShow event in javascript

查看:221
本文介绍了javascript中的pageShow事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

<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浏览器。知道为什么吗?

But the pageShow event is not firing in IE. Any idea why?

推荐答案

OnPageShow和OnPageHide是新的HTML5事件属性,因此只能享受有限的浏览器支持(在撰写本文时)

OnPageShow and OnPageHide are new HTML5 event attributes, and as such will only enjoy limited browser support (at the time of writing)

更高版本的现有浏览器更有可能支持它。根据这篇文章,Firefox肯定会和Safari一样。

Its more likely that later versions of incumbent browsers will support it. Firefox certainly will, as will Safari according to this article.

我找不到任何明确说明的内容,但我想说你正在使用的IE版本可能不支持这些事件。你可以发布这些信息以便澄清。

I couldn't find anything that stated it definitively, but I would say that its likely that these events aren't supported in the version of IE that you are using. Can you maybe post this information for clarification.

希望这会有所帮助

这篇关于javascript中的pageShow事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆