html5-canvas 如何将Html5画布元素添加到网页
示例
HTML5-Canvas...
是Html5元素。
大多数现代浏览器(InternetExplorer9+)支持。
是默认情况下透明的可见元素
默认宽度为300px,默认高度为150px。
需要JavaScript,因为所有内容都必须以编程方式添加到Canvas中。
示例:使用Html5标记和JavaScript创建Html5-Canvas元素:
<!doctype html>
<html>
<head>
<style>
body{ background-color:white; }
#canvasHtml5{border:1px solid red; }
#canvasJavascript{border:1px solid blue; }
</style>
<script>
window.onload=(function(){
//使用javascript添加画布元素
var canvas=document.createElement('canvas');
canvas.id='canvasJavascript'
document.body.appendChild(canvas);
}); //结束$(function(){});
</script>
</head>
<body>
<!-- add a canvas element using html -->
<canvas id='canvasHtml5'></canvas>
</body>
</html>
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短