欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript生成img標(biāo)簽的3種實(shí)現(xiàn)方法(對(duì)象、方法、html)

 更新時(shí)間:2015年12月25日 15:05:29   作者:釋然me  
這篇文章主要介紹了javascript生成img標(biāo)簽的3種實(shí)現(xiàn)方法,包括對(duì)象、方法、html三種實(shí)現(xiàn)方式,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了javascript生成img標(biāo)簽的3種實(shí)現(xiàn)方法。分享給大家供大家參考,具體如下:

<div id="d1"></div>
<script>
//HTML
function a(){
document.getElementById("d1").innerHTML="<img src='http://baike.baidu.com/cms/rc/240x112dierzhou.jpg'>";
}
a();
//方法
function b(){
var d1=document.getElementById("d1");
var img=document.createElement("img");
img.src="http://baike.baidu.com/cms/rc/240x112dierzhou.jpg";
d1.appendChild(img);
}
b();
//對(duì)象
function c(){
var cc=new Image();
cc.src="http://baike.baidu.com/cms/rc/240x112dierzhou.jpg";
document.getElementById("d1").appendChild(cc);
}
c();
</script>

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論