0

ページがあります.... http://kingola.com/test.htmlモバイルアプリ用に取り組んでいますが、何らかの理由で、画像が Android モバイルブラウザーに表示されませんが、表示されます私のMacのFirefoxでそれを。

また...何らかの理由でIEでは機能しません。

コード:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" media="all" href="style.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
    <title>Reading XML with jQuery</title>
     <script>
        $(document).ready(function(){
            $.ajax({
                type: "GET",
                url: "http://kingola.com/podcast/",
                dataType: "xml",
                success: function(xml) {
                    $(xml).find('item').each(function(){
                        // var id = $(this).attr('guid');
                        var title = $(this).find('title').text();
                        var url = $(this).find("enclosure").attr('url');
                        var description = $(this).find('description').text();
                        var img = $(this).find("itunes\\:image").attr('href');
                        $('<div class="items" id="link_"></div>').html('<a href="'+url+'">'+title+'</a>').appendTo('#page-wrap');
                        $('<div class="brief"></div>').html(description).appendTo('#page-wrap');
                        $('<div class="image"></div>').html('<img src="'+img+'">').appendTo('#page-wrap');
                        $('<div class="ima-link"></div>').html(img).appendTo('#page-wrap');
                    });
                }
            });
        });
     </script>
</head>
<body>
    <div id="page-wrap">
        <h1>Reading XML with jQuery</h1>
     </div>
</body>
</html>
4

2 に答える 2

0

表示されないためにソースが定義されていません。これを試していただけますか

$('<div class="image"></div>').html('<img src="'+img+'">').appendTo($("#page-wrap"));
于 2013-10-24T01:43:13.073 に答える
0

imgの変数が未定義です、ノードのセレクターが間違っているので、これを試してください

var img = $(this).find("image").attr('href');    

のノードの名前はイメージであるため、itunes はこれらのノードの名前空間です。

于 2013-10-24T01:54:11.850 に答える