<html>
<head>
<title>basic "autofocus" test</title>
<style>
input { background:red }
input:focus { background:lime }
</style>
<script src="../../resources/js-test-pre.js"></script>
<script language="JavaScript" type="text/javascript">
window.jsTestIsAsync = true;

function elementBlur() {
    document.getElementById("input1").type = "password";
}
function elementFocus() {
    document.getElementById("input1").type = "text";
}

function test() {
    document.getElementById("input2").focus();
    shouldBe('document.activeElement', 'document.getElementById("input2")');
    finishJSTest();
}
</script>
</head>
<body onload="test()">
<input id="input1" type="text" autofocus onblur="elementBlur()" onfocus="elementFocus()"/>
<br/>
<p>This form control should have a green background and active state:<input id="input2"> 
<hr>
<pre id="console">

</pre>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
