Created
April 2, 2012 09:33
-
-
Save williame/2282116 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript"> | |
<!-- | |
function onkey(event) { | |
if(event.target.id == "b") { | |
var c = document.getElementById("c"); | |
if(!c) { | |
document.getElementById("a").innerHTML += "<br/><input id=\"c\" type=\"text\"/>"; | |
c = document.getElementById("c"); | |
document.getElementById("status").textContent = "created c "+c | |
} else { | |
document.getElementById("status").textContent = "activing c "+c; | |
} | |
c.onkeydown = onkey; | |
c.focus(); | |
} else { | |
document.getElementById("status").textContent = "activing b"; | |
document.getElementById("b").focus(); | |
} | |
} | |
function test() { | |
var b = document.getElementById("b"); | |
b.onkeydown = onkey; | |
b.focus(); | |
} | |
//--> | |
</script> | |
<body onload="test();"> | |
<noscript> | |
Sorry, you need javascript. Not much to see here otherwise; move along. | |
</noscript> | |
<div id="status"></div> | |
<div id="a"> | |
<input id="b" type="text"/> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment