summaryrefslogtreecommitdiff
path: root/Base/res/html/misc/mouse-events.html
blob: 01210d7cb5f981e495f78d34cf73b67658987256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<style>
#rect {
    width: 300px;
    height: 300px;
    border: 5px solid black;
}
</style>
<div id=rect></div>
<pre id=out></pre>
<script>
function handle(e) {
    var out = document.getElementById('out');
    out.innerHTML = e.type + ' @ ' + e.offsetX + ',' + e.y + '\n' + out.innerHTML;
}

var rect = document.getElementById('rect');
rect.onmousedown = handle;
rect.onmousemove = handle;
rect.onmouseup = handle;
rect.onclick = handle;
rect.ondblclick = handle;
</script>