我想要添加到画布中的图像用作按钮。当我单击图像时,必须显示警报。还必须禁止单击画布的其余部分。我怎样才能做到这一点?谢谢。
<script>
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var quizbg = new Image();
quizbg.src = "basla.png";
context.drawImage(quizbg,0,0);
}
<script>
<body>
<div id="ccontainer">
<canvas id="myCanvas" width="600" height="400"></canvas>
</div>
</body>