提交表單時,進行驗證
<SCRIPT type=text/Javascript>
function checkform(forms)
{
if (forms.cont.value==''|| forms.cont.value.length<10 || forms.cont.value.length>5000)
{
alert('請輸入10至5000字符的內容');
return false;
}
}
</SCRIPT>
表單驗證是表單自己的屬性,要寫在表單代碼裡面
<form id="remark" method="post" action="addremark.ASPx" onsubmit="return checkform(this)>也可以加到按鈕裡面
<input type="image" src="imgshare/taolun3.gif" width="130" height="23" name="submit" onclick="return checkform(this.form)"/>