<script language="javascript">
function SendForm ()
{
if(CheckPost())
{
document.addForm.submit();
}
}
function CheckPost ()
{
if (addForm.user.value == "")
{
addForm.user.focus();
return false;
}
if (addForm.title.value.length < 5)
{
addForm.title.focus();
return false;
}
return true;
}
</script>
<form action="test.php" method="post" name="addForm">
<div>用户:<input type="text" size="10" name="user" maxlength="20"/></div>
<div>标题:<input type="text" name="title" maxlength="50"/></div>
<div>内容:<textarea name="content" rows="8" cols="30"></textarea></div>
<div><input type="button" name="submit" value="发表留言" onclick="SendForm();"/></div>
</form>
网友评论