2019-11-19 05:18:28 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Button test</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script src="mouse-helper.js"></script>
|
|
|
|
<button>Click target</button>
|
|
|
|
<script>
|
|
|
|
window.result = 'Was not clicked';
|
|
|
|
window.offsetX = undefined;
|
|
|
|
window.offsetY = undefined;
|
2020-02-13 03:13:21 +03:00
|
|
|
window.pageX = undefined;
|
|
|
|
window.pageY = undefined;
|
2019-11-19 05:18:28 +03:00
|
|
|
window.shiftKey = undefined;
|
2020-02-19 20:34:57 +03:00
|
|
|
window.pageX = undefined;
|
|
|
|
window.pageY = undefined;
|
2019-11-19 05:18:28 +03:00
|
|
|
document.querySelector('button').addEventListener('click', e => {
|
|
|
|
result = 'Clicked';
|
|
|
|
offsetX = e.offsetX;
|
|
|
|
offsetY = e.offsetY;
|
2020-02-13 03:13:21 +03:00
|
|
|
pageX = e.pageX;
|
|
|
|
pageY = e.pageY;
|
2019-11-19 05:18:28 +03:00
|
|
|
shiftKey = e.shiftKey;
|
|
|
|
}, false);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|