下面展示一些 内联代码片
。
红框按钮
<!DOCTYPE html>
<head>
<meta charset="utf-8">
</head>
<body>
<div style="text-align: center">
<canvas width="50" height="50" id="redBlock"></canvas>
</div>
<div style="text-align: center">
<button onclick="alert('Hello World!'); console.log('Hello World!')" style="float">点我</button>
</div>
</body>
<script>
var canvas=document.getElementById('redBlock');
var ctx=canvas.getContext('2d');
ctx.fillStyle='#FF0000';
ctx.fillRect(0,0,50,50);
</script>