在FORM中调用JS……如下:
<SCRIPT language=javascript>
function Checklogin()
{
if (form1.nicheng.value=="")
{
alert("请填写昵称");
myform.nicheng.focus();
return false;
}
if (form1.neirong.value=="")
{
alert("内容不能为空");
myform.neirong.focus();
return false;
}
} </SCRIPT>
<form id="form1" name="form1" method="post" action="liuyan.php" onsubmit="return Checklogin();">
<table width="496" border="1" align="center">
<tr>
<td width="319">昵称
<label>
<input type="text" name="nicheng" />
</label></td>
</tr>
<tr>
<td><label>
<textarea name="neirong" cols="70" rows="6"></textarea>
<input type="submit" name="Submit" value="发布留言" />
<input type="reset" name="Submit2" value="清空内容" />
</label></td>
</tr>
</table>
</form>