日期:2014-05-16 浏览次数:20566 次
var link=document.createElement("a"); link.id=0; link.href="#"; link.onclick=function(id,event){ switchPicTo(link.id,event); return false;}; document.getElementById("picbar").appendChild(link); var linkcanvas=document.createElement("canvas"); linkcanvas.id="slidepic0";; linkcanvas.width='100px'; linkcanvas.height='90px'; linkcanvas.style="background:white;margin-top:4px;margin-left:8px;"; link.appendChild(linkcanvas);
<div id="picbar"></div> <script type="text/javascript"> var link=document.createElement("a"); link.id=0; link.href="#"; link.onclick=function(id,event){ switchPicTo(link.id,event); return false;}; document.getElementById("picbar").appendChild(link); var linkcanvas=document.createElement("canvas"); linkcanvas.id="slidepic0";; linkcanvas.width='100'; linkcanvas.height='90'; // linkcanvas.cssText="background:red;margin-top:4px;margin-left:8px;"; linkcanvas.style.background="red"; link.appendChild(linkcanvas); </script>