问题在红色部分,在电脑上IE等浏览器都OK。
但在手机上 $('#news_ul').html(strhtml);
这段代码无效。只有前面加个断点才有效。
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
     <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>jQuery Mobile Demos</title>
    <link rel="stylesheet" href="css/themes/default/jquery.mobile-1.3.0.css">
    <link rel="stylesheet" href="docs/_assets/css/jqm-demos.css">
    <link rel="shortcut icon" href="docs/favicon.ico">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
    <!--    v1.9.1-->
    <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="docs/_assets/js/jquery.mobile.demos.js"></script>
    <script type="text/javascript" src="js/jquery.mobile-1.3.0.js"></script>
    <script type="text/javascript">
        $(document).bind('pageinit')
        {            var strhtml = '';
            var i = 0;
            var jsons;
            var NoticeId;
            var CreateTime;
            var Title;
            var NOTICEURL;
            var VIEWOFNUMBER;
            var NOTICEAUTHOR;
            var NOTICE;
            var ISSCHOOLNEWS;            //加载新闻列表 开始
            $.getJSON(
                     systemwebsite + "InterFaceWebService.asmx/GetSchoolNotice2_jsonSerialization?callback=?",
                    { uid: userid, CountTop: '10' },
                    function (data) {
                        if (jQuery.parseJSON(data.msg)[0].RESULT == "-1") //取得失败
                        {                            strhtml = "<li>" +
                                    "   <h3>" +
                                    "   <a href='#'>抱歉加载失败</a></h3>" +
                                    "   <p>" +
                                    "   <strong></strong></p>" +
                                    "   <p></p>" +
                                    "</li>";
                            $('#news_ul').html(strhtml);
                            $('#news_ul').listview('refresh');                            return;
                        }                        jsons = jQuery.parseJSON(data.msg);                        if (jsons) {
                            if (jsons.length > 0) {                                for (i = 0; i <= jsons.length - 1; i++) {                                    NoticeId = Url.decode(jsons[i].NoticeId);
                                    CreateTime = jsons[i].CreateTime.substr(5, 2) + "-" + jsons[i].CreateTime.substr(8, 2);
                                    Title = Url.decode(jsons[i].Title);
                                    NOTICEURL = jsons[i].URL;
                                    VIEWOFNUMBER = jsons[i].VIEWOFNUMBER;
                                    NOTICEAUTHOR = Url.decode(jsons[i].NOTICEAUTHOR);
                                    NOTICE = Url.decode(jsons[i].NOTICE);
                                    NOTICEAUTHOR = Url.decode(jsons[i].NOTICEAUTHOR);
                                    ISSCHOOLNEWS = Url.decode(jsons[i].ISSCHOOLNEWS);
                                    strhtml = strhtml + "<li>" +
                                    "   <h1>" +
                                    "   <a  title='" + Title
                                         + "'   href='#newcontentpage' data-rel='dialog'  data-transition='pop'  class='lnk_newscontent' NOTICEID='" +
                                         NoticeId + "' NoticeTitle='" + jsons[i].Title + "'  NOTICEAUTHOR='" +
                                         jsons[i].NOTICEAUTHOR + "'  NOTICE='" + jsons[i].NOTICE
                                         + "'  CreateTime='" + jsons[i].CreateTime + "' >" + Title + "</a></h1>" +
                                    // "   <a href='../../../newcontent.html?NOTICEID=" + NoticeId + '&i=' + String(i) + "' data-rel='dialog'  data-transition='pop'  data-ajax='false' >" + Title + "</a></h1>" +
                                    "   <p>" +
                                    "   <strong>" + NOTICEAUTHOR + "</strong>" +
                                    "   " + CreateTime +
                                    "</p>" +
                                    "</li>";
                                }
                                alert('点击进入新闻列表');
                                $('#news_ul').html(strhtml);
                                refresh_page();
                            }
                            else { //没有数据
                                strhtml = "<li>" +
                                        "   <h1>" +
                                        "   <a href='#'>抱歉没有数据</a></h1>" +
                                        "   <p>" +
                                        "   <strong></strong></p>" +
                                        "</li>";
                                $('#news_ul').html(strhtml);
                                refresh_page();
                            }                        }
                        else { //没有数据
                            strhtml = "<li>" +
                                    "   <h1>" +
                                    "   <a href='#'>抱歉没有数据</a></h1>" +
                                    "   <p>" +
                                    "   <strong></strong></p>" +
                                    "</li>";
                            $('#news_ul').html(strhtml);
                            refresh_page();
                        }
                    });
            //加载新闻列表 结束
        }
        //刷新新闻列表样式 开始
        function refresh_page() {
            $('#news_ul').listview('refresh');
            //  $('a').('refresh');
        }
        //刷新新闻列表样式 结束        //点击新闻链接,加载新闻内容开始
        $(".lnk_newscontent").live("click", function (event) {
            var strhtml = "<li>" +
            "   <h1>" +
            "   " + Url.decode($(this).attr('NoticeTitle')) + " </h1>" +
            "   <p>" +
            "   <strong>" + Url.decode($(this).attr('NOTICEAUTHOR')) + "</strong>" +
            "   " + $(this).attr('CreateTime').substr(5, 2) + "-" + $(this).attr('CreateTime').substr(8, 2) +
                "</p>" +
                    "   <p>" + Url.decode($(this).attr('NOTICE')) +
                "</p>" +
            "</li>";            $("#newcontent_ul").html(strhtml);
            try {
                $('#newcontent_ul').listview('refresh');
            }
            catch (err) {
                //alert("猪头!出错啦");
            }        });
        //点击新闻链接,加载新闻内容结束    </script>
</head>
<body>
    <!-- homepage -->
    <div data-role="page" id="homepage" data-pisition="fixed">
        <div data-role="header" >
            <a href="../../../aa.html" data-icon="back" data-ajax='false'>首页</a>
            <h1>
                校园新闻</h1>
            <!--<a href="#" class="jqm-navmenu-link" data-icon="bars" data-iconpos="notext">Navigation</a>
            <a href="#" class="jqm-search-link" data-icon="search" data-iconpos="notext">Search</a>-->
        </div>
        <!-- /header -->
        <div data-role="content" class="jqm-content">
            <ul data-role='listview' id='news_ul'>
                <li>
                    <p>
                        <strong>我正在拼命加载......</strong></p>
                    <p>
                    </p>
                </li>
            </ul>
        </div>
        <!-- /content -->
        <div data-role="footer" data-id="foo1" data-position="fixed">
            <div data-role="navbar">
                <ul>
                    <li><a href="newindex.html" data-prefetch="true" data-transition="none" class="ui-btn-active ui-state-persist">
                        Info</a></li>
                    <li><a href="docs/widgets/footers/footer-persist-b.html" data-prefetch="true" data-transition="none">
                        Friends</a></li>
                    <li><a href="docs/widgets/footers/footer-persist-c.html" data-prefetch="true" data-transition="none">
                        Albums</a></li>
                    <li><a href="docs/widgets/footers/footer-persist-d.html" data-prefetch="true" data-transition="none">
                        Emails</a></li>
                </ul>
            </div>
            <!-- /navbar -->
        </div>
        <!-- /footer -->
        <!-- /jqm-footer -->
    </div>
    <!-- /homepage -->
    <div data-role="page" id='newcontentpage'>
        <div data-role="header">
            <h1>
                新闻内容
            </h1>
        </div>
        <!-- /header -->
        <div data-role="content" class="jqm-content">
            <ul data-role='listview' id='newcontent_ul'>
                <li>
                    <p>
                        <strong>我正在拼命加载......</strong>
                    </p>
                    <p>
                    </p>
                </li>
            </ul>
        </div>
        <!-- /content -->
        <!--      <div data-role="footer" data-id="foo2" data-position="fixed">
     
        <!-- /navbar -->
    </div>
    <!-- /newcontentpage -->
</body>
</html>