WebCore/manual-tests/focus-change-between-key-events.html
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 01:32:07 +0300
changeset 2 303757a437d3
parent 0 4f2f89ce4247
permissions -rw-r--r--
Revision: 201037 Kit: 201039

<body onload="document.getElementById('dummy').focus();">
<iframe src="data:text/html,<body onload='document.getElementsByTagName(&quot;input&quot;)[0].focus()'><input></body>" id=victim name=victim>
</iframe>
<script>

var cur_pos = 0;

function maybe_redirect(e) {
  var evt = window.event ? event : e;
  var cc = evt.charCode ? evt.charCode : evt.keyCode;

  document.getElementById('victim').focus();
  frames['victim'].focus();

  document.getElementById('dummy').value += String.fromCharCode(cc).toLowerCase();

  setTimeout('focus();document.getElementById("dummy").focus()',1);
}


</script>
<p>Type some text. It should only appear in the below input field.</p>
<input type=text onkeydown="maybe_redirect(event)" id=dummy>
</body>