I copied and pasted your code, added the name="frmLogin" to the <form> tag, and it worked fine for me in both IE7 and FF2. Did you refresh the browser page to make sure you got the latest version of the file?
Working code:
<form action="" method="post" id="frmLogin" name="frmLogin">
<table width="400" border="1" cellpadding="2" cellspacing="2">
<tr>
<td>User Id</td>
<td><input name="username" type="text" id="username" /></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password" /></td>
</tr>
<tr>
<td> </td>
<td><input name="btnLogin" type="submit" id="btnLogin" value="Login" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
document.frmLogin.username.focus();
</script>