<html>
<head>
<title>membuat validasi</title>
<script language="javascript">
function ValidasiForm ()
{ if (document.FormTamu.nama.value==""){
alert ("kolom nama tidak boleh kosong");
return false;
}
if (document.FormTamu.alamat.value==""){
alert ("Kolom Alamat tidak boleh kosong");
return false;
}
if (document.FormTamu.email.value==""){
alert ("Kolom Email tidak boleh kosong");
return false;
}
if (!document.FormTamu.setuju.checked){
alert ("anda belum menyetujui bahwa data anda benar");
return false;
}
}
</script>
</head>
<body>
<form onSubmit="return ValidasiForm ()" name="FormTamu"
method="post" action=''>
<table class="TABLE" width="307" border="0"
cellspasing="0" cellpadding="3">
<tr align="left" bgcolor="yellow">
<th colspan="2" scope="col">Form Validasi</th>
</tr>
<tr>
<td width="92">Nama </td>
<td width="246">
<input name="nama" type="text" id="nama" size="25"
maxlength="35"></td>
</tr>
<tr>
<td>Alamat</td>
<td><input name="alamat" type="text" id="alamat"
size="25" maxlength="35"></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" type="text" id="email"
size="25" maxlength="35"></td>
</tr>
<td><input type="checkbox" name="setuju" value="setuju"><th colspan="2" scope="col">Saya menyatakan bahwa data di atas benar adanya</th></td><br>
<tr>
<td> </td>
<td><input type="submit" name="submit"
value="Kirim"></td>
</tr>
</table>
</form>
</body>
</html>