set focus kursor

ria · Oct 17, 2011
mas mau nanya nih,,gimana cara'y kursor langsung berada di input type tertentu....
semisal form login...
<form name="login" method="POST" action="ceklogin.php" onSubmit="return validasi(this)">
		
<table align="center" border="0" width="240" cellpadding="2" cellspacing="1" bgcolor="#0000CC" >
<tr bgcolor="#FF9900">
<td bgcolor="#FF9900" colspan="2" ><font face="Verdana, Arial, Helvetica, sans-serif" size="2px"><center><strong>Login Mahasiswa :</strong></td>
</tr>
<tr bgcolor="#FFFFFF"> 
<td bgcolor="#DBEAF5"><font face="Verdana, Arial, Helvetica, sans-serif" size="2px"> NIM</td><td bgcolor="#DBEAF5"> <input type="text" name="NIMHS"  ></td>
</tr>
<tr>
<tr bgcolor="#FFFFFF"> 
<td bgcolor="#DBEAF5"><font face="Verdana, Arial, Helvetica, sans-serif" size="2px">Password</td><td bgcolor="#DBEAF5">   <input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#DBEAF5"><input type="submit" value=" Login" name="login"></td>
</tr>
biar otomatis set focus langsung ke login mahasiswa...gimana cara'y mas
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Oct 18, 2011 · 0 Suka · 0 Tidak Suka
<form name="login" method="POST" action="ceklogin.php" onSubmit="return validasi(this)">
 
<table align="center" border="0" width="240" cellpadding="2" cellspacing="1" bgcolor="#0000CC" >
<tr bgcolor="#FF9900">
<td bgcolor="#FF9900" colspan="2" ><font face="Verdana, Arial, Helvetica, sans-serif" size="2px"><center><strong>Login Mahasiswa :</strong></td>
</tr>
<tr bgcolor="#FFFFFF"> 
<td bgcolor="#DBEAF5"><font face="Verdana, Arial, Helvetica, sans-serif" size="2px"> NIM</td><td bgcolor="#DBEAF5"> <input type="text" name="NIMHS" id="NIMHS"/><!-- dirubah --></td>
</tr>
<tr>
<tr bgcolor="#FFFFFF"> 
<td bgcolor="#DBEAF5"><font face="Verdana, Arial, Helvetica, sans-serif" size="2px">Password</td><td bgcolor="#DBEAF5">   <input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#DBEAF5"><input type="submit" value=" Login" name="login"></td>
</tr>
<script type="text/javascript">
document.getElementById('NIMHS').focus();
</script>