HTML5火了,JS也得炼一炼
用Javascript往一个p中插入一张图片
window.onload = function (){
var bigImg = document.createElement("img");//创建一个img元素
bigImg.src="http://www.baidu.com/img/baidu_sylogo1.gif"; //给img元素的src属性赋值
//bigImg.width="320"; //320个像素 不用加px
var myp = document.getElementById('myp'); //获得dom对象
myp.appendChild(bigImg); //为dom添加子元素img
};