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

js+html5繪制圖片到canvas的方法

 更新時間:2015年06月05日 11:58:37   作者:pythoner  
這篇文章主要介紹了js+html5繪制圖片到canvas的方法,涉及html5元素操作的相關(guān)技巧,需要的朋友可以參考下

本文實例講述了js+html5繪制圖片到canvas的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100"
style="border:1px solid #c3c3c3;">
Your browser does not support the HTML5 canvas tag.
</canvas>
<script type="text/javascript">
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var img=new Image();
img.onload = function(){
ctx.drawImage(img,0,0);
};
img.src="img_flwr.png";
</script>
</body>
</html>

更多關(guān)于JavaScript相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《JavaScript動畫特效與技巧匯總》《JavaScript運動效果與技巧匯總》及《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)

希望本文所述對大家的web程序設(shè)計有所幫助。

相關(guān)文章

最新評論