$("li").each(function(index){
$(this).attr("id","skin"+(index+1)).html('<img src="pic/skin_'+(index+1)+'.jpg"/>')
//或者可以这样 var img=$("img").attr("src","pic/skin_'+(index+1)+'.jpg") $(this).attr("id","skin"+(index+1)).append(img)
})
})
<script type="text/javascript">function jion1() {
var img = document.getElementById("dd")//dd为img的id img的src为空值
var img1 = img.setAttribute("src", "images/psd_34.gif")
}
</script>
var index = 0// index为0-4$("hotorder ol li
").eq(index).find("p a").append($("<img src='address.jpg' />"))
这样应该可行
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)