<script language="text/javascript">
function check_form(Obj)
{
if(Obj.t.value == '' || Obj.a.value == '') {
alert('输入框不能为空');
return false;
}
return true;
}
</script>
<form name="form" method="post" action="a.php" onsubmit="return check_form(this);">
<input type='text' name='t'>
<input type='text' name='a'>
<input type="submit" name="submit" value="submit">
</from>
function check_form(Obj)
{
if(Obj.t.value == '' || Obj.a.value == '') {
alert('输入框不能为空');
return false;
}
return true;
}
</script>
<form name="form" method="post" action="a.php" onsubmit="return check_form(this);">
<input type='text' name='t'>
<input type='text' name='a'>
<input type="submit" name="submit" value="submit">
</from>
function check_form()
{if(document.getElementById("p[t]").value == '' || document.getElementById("p[a]").value == '') {
alert('输入框不能为空');
return false;
}
return true;
}