<article>文章</article>
?
<script type="text/javascript">
<!--
function videodivscript(){
//获得标签<article>
? ? var articletag =document.getElementsByTagName("article");
? ? if(articletag.length>0){
//创建标签div
? ? ? ? var videodivElement= document.createElement("div");
//修改属性
? ? ? ? videodivElement.setAttribute("class","video_container");
//创建视频标签
? ? ? ? var videoElement= document.createElement("video");
? ? ? ? videoElement.setAttribute("src","http://flv1.gmw.cn/gmw/videoroot/2014-11-24/1416794580498.mp4");
? ? ? ? videoElement.setAttribute("type","video/mp4");
? ? ? ? videoElement.setAttribute("controls","");
? ? ? ? videoElement.setAttribute("poster","http://flv1.gmw.cn/gmw/videoroot/2014-11-24/1416794580498.jpg");
? ? ? ? videoElement.setAttribute("preload","none");
//新标签相互嵌套
? ? ? ? videodivElement.appendChild(videoElement);
//在标签article之前插入标签videodivElement
? ? ? ? document.body.insertBefore(videodivElement , articletag[0] );
? ? }
}
//运行
videodivscript();
-->
</script>
原文:http://worktianqi.iteye.com/blog/2160013