Rabu, 06 Juni 2018

Pertemuan 12 membuat Login dan Index




Pertemuan 12 membuat Login dan Index





Berikut Code yang harus anda isi pada notepad++ agar bisa menampilkan seperti gambar yang di atas

Code Untuk Login :
<!DOCTYPE html>
<html>
<head>
<script>
function Login(){
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="imam" && password=="ganteng"){
alert ("BERHASIL LOGIN GUYS");
window.location.href-"index.html";
}else {
alert ("Maaf Anda Jelek")
}
}
</script>
</head>
<body style="background-color:#00253d;color:grey;">
<form name="login">
<table width="255" cellpadding="4" align="center">
<tr height="300"> </tr>
<tr><td>Username</td><td>
<input type="text" name="username"></td></tr>
<tr> <td>password</td>
<td> <input type="password" name="password"></td></tr>
<tr><td colspan="2" align="right">
<input type="button" value="Login" onClick="Login()"></td></tr>
</table>
</form>
</body>
</html>

Code Untuk Index :
<!DOCTYPE html>
<html>
<head>
<title> PMB </title>
<script>
function hitungumur(){
var myForm = document.konten;
var x = document.getElementById("tahun").value
var y = 2018 - x;
document.getElementById("umur").value = y;
}
</script>
</head>
<body>
<form name="header">
<ul>
<li> <a href="#">Home </a></li>
<li> <a href="#">Regist </a></li>
</ul>
</form>
<hr>
<form name="konten">
<div>
<h1> Form Pendaftaran Mahasiswa </h1>
<table>
<tr>
<td>Nama</td>
<td> <input type="text" placeholder="Nama Lengkap" name="nama"> </td>
</tr>
<tr>
<td>Tempat Lahir</td>
<td> <input type="text" placeholder="Tempat Lahir" name="tl"> </td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td> 
<select id="tanggal"> <option> --Tanggal-- </option>
<script>
var tgl = 1;
while (tgl <= 31) { 
document.write("<option>" + tgl + "</option>");
tgl=tgl+1;
}
</script>
</select>
<select id="bulan"> <option> --Bulan-- </option>
<script>
var bulan = ["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"];
for(i=0;i<=11;i++){
document.write("<option>" + bulan[i] + "</option>");
}
</script>
</select>
<select id="tahun" onchange="hitungumur()"> <option> --Tahun-- </option>
<script>
var tahun = 1945;
for(i=2018;i>=tahun;i--){
document.write("<option>" + i + "</option>");
}
</script>
</select>
</td>
</tr>
<tr>
<td>Umur</td>
<td> <input type="text" id="umur"> </td>
</tr>
</table>
</div>
</form>
</body>
</html>


0 komentar:

Posting Komentar