HTML5 canvas的事件
<script>
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.strokeStyle = "black";
context.fillStyle = "red";
context.rect(0, 0, 300, 400);
context.fill();
canvas.onmousedown = function() {
console.log("123");
}
canvas.onmouseup = function() {
console.log("456");
};
canvas.onmousemove = function() {
console.log("789");
}
canvas.onclick = function() {
console.log("999");
}
</script>
- onabort: null
- onbeforeunload: null
- onblur: null
- oncanplay: null
- oncanplaythrough: null
- onchange: null
- onclick: null
- oncontextmenu: null
- ondblclick: null
- ondeviceorientation: null
- ondrag: null
- ondragend: null
- ondragenter: null
- ondragleave: null
- ondragover: null
- ondragstart: null
- ondrop: null
- ondurationchange: null
- onemptied: null
- onended: null
- onerror: null
- onfocus: null
- onhashchange: null
- oninput: null
- oninvalid: null
- onkeydown: null
- onkeypress: null
- onkeyup: null
- onload: null
- onloadeddata: null
- onloadedmetadata: null
- onloadstart: null
- onmessage: null
- onmousedown: null
- onmousemove: null
- onmouseout: null
- onmouseover: null
- onmouseup: null
- onmousewheel: null
- onoffline: null
- ononline: null
- onpagehide: null
- onpageshow: null
- onpause: null
- onplay: null
- onplaying: null
- onpopstate: null
- onprogress: null
- onratechange: null
- onreset: null
- onresize: null
- onscroll: null
- onsearch: null
- onseeked: null
- onseeking: null
- onselect: null
- onstalled: null
- onstorage: null
- onsubmit: null
- onsuspend: null
- ontimeupdate: null
- onunload: null
- onvolumechange: null
- onwaiting: null
- onwebkitanimationend: null
- onwebkitanimationiteration: null
- onwebkitanimationstart: null
- onwebkittransitionend: null