Hook up synthetic click activation to script_task and <>.click()

This commit is contained in:
Manish Goregaokar 2014-11-24 20:12:17 +05:30
parent e68119f82f
commit c89ec3910f
4 changed files with 63 additions and 5 deletions

View file

@ -0,0 +1,31 @@
<style>
</style>
<form action="http://example.com" method="get">
<div><input type="checkbox"></div>
<div><input type="submit"><input type="reset"></div>
<div><input type="checkbox"></div>
<div><input type="checkbox" checked></div>
<div>group 1
<div><input type="radio"></div>
<div><input type="radio" checked></div>
</div>
<div>group 2
<div><input type="radio" name="a" checked></div>
<div><input type="radio" name="a"></div>
</div>
</form>
<br>
Use the buttons below to shift "fake" focus and trigger click events. The first form widget is initually focused.
<br>
<button type=button id="left">Shift fake focus left</button><br>
<button type=button id="right">Shift fake focus right</button><br>
<button type=button id="click">Trigger synthetic click</button><br>
<script>
i = 0;
tags = document.getElementsByTagName("input");
document.getElementById("left").onclick=function(){i--;}
document.getElementById("right").onclick=function(){i++;}
document.getElementById("click").onclick=function(){tags[i].click()}
</script>