87,996
社区成员




if($("#username").val()=="" || $("#username").val()==null){
alert("please input username");
}
<html>
<head>
<title> Page 2 </title>
<script language="javascript">
<!--
function checkbox(){
if(document.getElementsByName("number")[0].value=""){
alert("please input username");
document.getElementsByName("number")[0].focus();
}
}
-->
</script>
</head>
<body>
<form>
<table>
<tr>
<td> user name </td>
<td> <input type="text" name="username" size="15" </td>
<td> <input type="submit" name="number" value="submit" onClick="checkbox()">| <input type="submit" value="reset"> </td>
<td> code </td>
<td> <input type="text" name="code" size="15" </td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<title> Page 2 </title>
<script language="javascript">
<!--
function checkbox(){
if(document.getElementById("username").value==""){
alert("please input username");
document.form.number.focus();
}
}
-->
</script>
</head>
<body>
<form>
<table>
<tr>
<td> user name </td>
<td> <input type="text" id="username" name="username" size="15"> </td>
<td> <input type="submit" name="number" value="submit" onClick="checkbox()">| <input type="submit" value="reset"> </td>
<td> code </td>
<td> <input type="text" name="code" size="15"></td>
</tr>
</table>
</form>
</body>
</html>