<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Wayne Nolting (w.nolting@home.com) -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.form.textfield1.value=="") {
themessage = themessage + " - textfield1";
}
if (document.form.textfield2.value=="") {
themessage = themessage + " - textfield2";
}
if (document.form.textfield3.value=="") {
themessage = themessage + " - textfield3";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.form.submit();
}
else {
alert(themessage);
return false;
}
}
</script>Fungsi
verify()diberikan pada event "onClick" tombol submit.Semoga bermanfaat.
Tidak ada komentar:
Posting Komentar