<html> | |
<head> | |
<title>dynamically inserted control with "autofocus" set</title> | |
<style> | |
input { background:red } | |
input:focus { background:lime } | |
</style> | |
<script language="JavaScript" type="text/javascript"> | |
function log(message) { | |
document.getElementById("console").innerHTML += "<li>"+message+"</li>"; | |
} | |
function test() { | |
if (window.testRunner) | |
testRunner.dumpAsText(); | |
if (document.activeElement == document.getElementsByTagName("input")[0]) | |
log("SUCCESS"); | |
else | |
log("FAILURE"); | |
} | |
</script> | |
</head> | |
<body onload="test()"> | |
<p>FAIL (The script did not run.)</p> | |
<script> | |
document.getElementsByTagName('p')[0].innerHTML = "This form control should have a green background: <input autofocus>"; | |
</script> | |
<hr> | |
<ol id="console"></ol> | |
</body> | |
</html> |