Page 62 - Modul web baru
P. 62

www.flipbuilder.com                                    www.flipbuilder.com                                57  www.flipbuilder.com







                        </script>

                       ❑  Jalankan dengan browser.
                     Validasi Data dengan JavaScript:
 www.flipbuilder.com                                    www.flipbuilder.com                                    www.flipbuilder.com
                     ❑  Ketikkan script berikut :
                     <html>
                     <head>
                     <title>Membuat Validasi</title>
                       <script LANGUAGE="JAVASCRIPT">
                     function ValidasiForm()


                            if (document.FormTamu.nama.value=="") {
                       {                  alert("Kolom nama tidak boleh kosong");
                              }           return false;
 www.flipbuilder.com                                    www.flipbuilder.com                                    www.flipbuilder.com
                            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;
                     </script>
 www.flipbuilder.com                                    www.flipbuilder.com                                    www.flipbuilder.com
                     </head>
                     <body>
                     <form    onSubmit="return  ValidasiForm()"  name="FormTamu"  method="post"
                     action="">
                       <table class="TABLE" width="307" border="0" cellspacing="0" cellpadding="3">
                         <tr align="left" bgcolor="#00FF00">
                           <th colspan="2" scope="col">Form Validasi </th>
                         </tr>
                         <tr>
                           <td width="92">Nama </td>
 www.flipbuilder.com                                    www.flipbuilder.com                                    www.flipbuilder.com
                           <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>                 type="text"            id="email"     size="25"
                           <td><input
                                        name="email"
 www.flipbuilder.com                                    www.flipbuilder.com                                    www.flipbuilder.com
                     maxlength="35"></td>
                         </tr>
                         <tr>

                     Modul Pemrograman Web SMKN 2 Mojokerto






 www.flipbuilder.com                                    www.flipbuilder.com                                    www.flipbuilder.com
   57   58   59   60   61   62   63   64   65   66   67