Oops...
As soon as I posted it, I've found the solution myself. It is to put the element.select()
function in KMDidShowWindow()
:
<html>
<head>
<script>
function KMDidShowWindow(){
document.getElementById("myid").select();
}
</script>
</head>
<body>
<div><input type="text" id="myid" name="LocalName" autofocus/></div>
</body>
</html>