使用js获取html代码段中的标签属性解决方案

使用js获取html代码段中的标签属性
如有这么一个html代码的字附串:
var htmlStr="<P align=center> <FONT size=3> <IMG src='18.jpg' title='1111' width=636 border=0>ddd <IMG style='WIDTH: 294px; HEIGHT: 245px' src='2.jpg'  title='22222' width=441 height=341 border=0> </P>";  

如何获得IMG标签中的src和title的值

我知道如果在html文档中可以使用
$("img").each(function(index, element) {  
       str += $(this).attr("title")+","  
   });  
的这样代码取得,但对于一个字附串,如上面的htmlStr 如何取得它里面IMG标签中的src和title的值???
请高手求助


------解决思路----------------------
$(htmlStr).find("img").each(function(index, element) {  
       str += $(this).attr("title")+","  +this.src
   });