var entry = result.feed.entries[i];
var div = document.createElement("div");
somewhere in the output of
div.appendChild(document.createTextNode(entry.content));
there are several
<img s开发者_Python百科rc="http://ww...
is there a simple way just to get image url? Maybe something with .match?
here's the way i did it..
var findImg = entry.content;
var img = $(findImg).find('img').eq(0).attr('src'); //i use jquery to find 1st img src
function imgFeed(){
var defaultImg= "images/default.jpg";
if(img==null){
return defaultImg; // if cant find any, show default image src
}else{
return img;
}
}
yourElement.append('<img width="194" height="91" src="'+imgFeed()+'" alt="#" />');
精彩评论