0

这是来自 RSS 提要的 xml 文件的片段

<item>
<title>creamy whites</title>
<description>&lt;p&gt;&lt;a href="/pin/201606520789168653/"&gt;&lt;img 
src="http://media-cache.pinterest.com/upload/229261437250994034_0HxSxJNv_b.jpg"
&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;creamy whites&lt;/p&gt;</description>
</item>

现在这是 ZRRSfeed 中已经存在的代码:

// Add feed row
html += '<li class="rssRow '+row+'">' + 
    '<'+ options.titletag +'><a href="'+ entry.link +'" title="'+          
        feeds.title +'" target="'+ options.linktarget +'">'
        + entry.description +'</a></'+ 
        options.titletag +'>'

现在,我不想得到entry.decription我想要得到的src值,我entry.decription 已经尝试过: entry.decription[src],,,,(我可能在这里输入错误的任何代码 - 但是当我尝试它们时,我确实在谷歌中检查了类似' getAttribute') 并且它们都不起作用。entry.decription[src].val()entry.decription->src entry.decription.attr(src)entry.decription.getAtrribute("src")

4

2 回答 2

1

试试这个。。

var src = $('entry.description')find('img').attr('src');

console.log(src); // debug using console firebug in firefox
//or developer tools in chrome
//the output should be the url of img

然后用 src 替换位于锚标记内的 entry.description。

于 2012-05-22T13:10:33.953 回答
0

尝试

$(entry.description).find('img').attr('src')
于 2012-04-14T22:18:04.863 回答