http://www.mindphp.com/forums/viewforum.php?f=25" onclick="window.open(this.href);return false;
ตัวอย่าง JavaScript ง่ายๆ ไว้สำหรับ validate Form
โค้ด: เลือกทั้งหมด
<script language="JavaScript">
function validForm(passForm) {
if (passForm.username.value.replace( /\s+$/, "" )=="")
{
alert("กรุณาใส่ชื่อสมาชิก/Please enter your username" );
passForm.username.focus();
return false;
}
if (passForm.password.value.replace( /\s+$/, "" )=="")
{
alert("กรุณาใส่รหัสผ่าน/Please enter your password" );
passForm.password.focus();
return false;
}
return true;
}
//-->
</script>