Code: Select all
<!DOCTYPE html>
<html>
<body>
<div id="target">
Tap me, click me, or touch me!
</div>
<script>
var targetBox = document.getElementById("target");
targetBox.onpointerdown = handleDown;
function handleDown(evt) {
var action;
switch(evt.pointerType) {
case "mouse":
action = "clicking";
break;
case "pen":
action = "tapping";
break;
case "touch":
action = "touching";
break;
default:
action = "interacting with";
break;
}
targetBox.innerHTML = "<strong>Thanks for " + action + " me!</strong>";
evt.preventDefault();
}
</script>
</body>
</html>
Full AHK script:
Code: Select all
html =
(
<!DOCTYPE html>
<html>
<body>
<div id="target">
Tap me, click me, or touch me!
</div>
<script>
var targetBox = document.getElementById("target");
targetBox.onpointerdown = handleDown;
function handleDown(evt) {
var action;
switch(evt.pointerType) {
case "mouse":
action = "clicking";
break;
case "pen":
action = "tapping";
break;
case "touch":
action = "touching";
break;
default:
action = "interacting with";
break;
}
targetBox.innerHTML = "<strong>Thanks for " + action + " me!</strong>";
evt.preventDefault();
}
</script>
</body>
</html>
)
Gui, +Resize
Gui, Margin, 0, 0
Gui, Add, ActiveX, w700 h300 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge">
WB.document.write(html)
Gui, Show
Return
GuiSize:
GuiControl, Move, WB, w%A_GuiWidth% h%A_GuiHeight%
Return
GuiClose:
ExitApp