<script type="text/javascript">
function check()
{
if(document.all.user_name.value=='')
{
alert("用户名不能为空");
document.all.user_name.focus();
return false;
}
return true;
}
</script><form name="form1" post="confirm.php" onsubmit="return check();">
<input type="text" name="user_name">
<input type="submit" name="submit">
</form>
function check()
{
if(document.all.user_name.value=='')
{
alert("用户名不能为空");
document.all.user_name.focus();
return false;
}
return true;
}
</script><form name="form1" post="confirm.php" onsubmit="return check();">
<input type="text" name="user_name">
<input type="submit" name="submit">
</form>
function check()
{
if(user_name.value=="")
return false;
}
</script><form name="form1" post="confirm.php" onsubmit="return check();">
<input type="submit" name="submit">呵呵</form>
function check(obj)
{
if(!obj.user_name.value)
return false;
}
</script><form name="form1" post="confirm.php" onsubmit="return check(this);">
<input type="submit" name="submit"></form>