WEB DESIGN PERTEMUAN 13-14 Membuat Login dan Home,Form Pendaftaran,Form Tabel Harga
1. Membuat index dengan login
Berikut Code nya :
<html>
<script>
function Login(){
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="admin" && password=="admin"){
alert("Selamat anda berhasil login");
window.location.href="home.html";
}
else{
alert("User name dan password anda salah!");
}
}
</script>
<body style="background-color:#00253d;color:white;">
<form name="login" >
<table width="225" cellpadding="4" align="center">
<tr height="300px"> </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>
</body>
</html>
2. membuat Home
Berikut Codenya :
<DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<title> Form Pendaftaran Mahasiswa </title>
<script>
function hitung(){
var myForm = document.konten;
var x=document.getElementById("tahun").value
var y=document.getElementById("bulan").value
var z = 2018 - x;
document.getElementById("umur").value = z;
}
function AngkaSaja(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
</head>
<body>
<div class="col-md-12">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">PMB UBS</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="home.html">Home</a></li>
<li><a href="pendaftaran.html">Pendaftaran</a></li>
<li><a href="tabelharga.html">Tabel Harga</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
</ul>
</div>
</nav>
<div class="col-md-12">
<label> Selamat datang silahkan memilih menu ini :</label>
<form action="pendaftaran.html">
<button class="btn btn-success">Pendafaran</button>
</form>
<form action="tabelharga.html">
<button class="btn btn-info">Daftar Harga</button>
</form>
</div>
</div>
</body>
</html>
3. Membuat Form pendaftaran
Berikut Codenya :
<DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<title> Form Pendaftaran Mahasiswa </title>
<script>
function hitung(){
var x=document.getElementById("tahun").value
var y=document.getElementById("bulan").value
var z = 2018 - x;
document.getElementById("umur").value = z;
}
function AngkaSaja(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
function resetForm(){
document.konten.reset();
}
</script>
</head>
<body>
<div class="col-md-12">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">PMB UBS</a>
</div>
<ul class="nav navbar-nav">
<li><a href="home.html">Home</a></li>
<li class="active"><a href="pendaftaran.html">Pendaftaran</a></li>
<li><a href="tabelharga.html">Tabel Harga</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
</ul>
</div>
</nav>
<div class="col-md-6">
<form name="konten">
<h1> Pendaftaran Mahasiswa Baru </h1>
<table class="table" >
<tr>
<td>Nama </td>
<td colspan="3"> <input type="text" placeholder="nama lengkap" id="nama" class="form-control"> </td>
</tr>
<tr>
<td>Tempat Lahir </td>
<td colspan="3"> <input type="text" placeholder="tempat lahir" id="tl" class="form-control">
</tr>
<tr>
<td>Tanggal Lahir </td>
<td>
<select id="tanggal" class="form-control" > <option>-Tanggal-</option>
<script>
var i = 1;
while(i<=31){
document.write("<option>" + i + "</option>");
i=i+1;
}
</script>
</select>
</td>
<td>
<select id="bulan" class="form-control"> <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>
</td>
<td>
<select id="tahun" class="form-control" onchange="hitung()"> <option>-Tahun-</option>
<script>
var tahun = 1945;
for(i=2018;i>=tahun;i--){
document.write("<option value="+i+">" + i + "</option>");
}
</script>
</select>
</td>
</tr>
<tr>
<td>Umur </td>
<td colspan="3"><input type="text" id="umur" class="form-control" disabled> </td>
</tr>
<tr>
<td>Konsentrasi </td>
<td colspan="3">
<select id="bulan" class="form-control" > <option>-Konsentrasi-</option>
<script>
var kons = ["Teknik Informatika", "Administrasi Bisnis", "Administrasi Perkantoran", "Komputerisasi Akuntansi", "Hubungan Masyarakat"];
for(i=0;i<=4;i++){
document.write("<option>" + kons[i] + "</option>");
}
</script>
</select>
</td>
</tr>
<tr>
<td>No Telepon </td>
<td colspan="3"><input type="text" id="telp" value="" maxlength="13" onkeypress="return AngkaSaja(event)" class="form-control"> </td>
</tr>
</table>
<br>
<button class="btn btn-danger" onClick="tampilkan()">Clear</button>
</form>
</div>
<div class="col-md-6">
</div>
</div>
</body>
</html>
4. Membuat Form Tabel Harga
Berikut Codenya :
<DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<title> Form Pendaftaran Mahasiswa </title>
<script>
function hitung(){
var myForm = document.konten;
var x=document.getElementById("tahun").value
var y=document.getElementById("bulan").value
var z = 2018 - x;
document.getElementById("umur").value = z;
}
function AngkaSaja(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
</head>
<body>
<div class="col-md-12">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">PMB UBS</a>
</div>
<ul class="nav navbar-nav">
<li><a href="home.html">Home</a></li>
<li><a href="pendaftaran.html">Pendaftaran</a></li>
<li class="active"><a href="tabelharga.html">Tabel Harga</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
</ul>
</div>
</nav>
<div class="col-md-12">
<h1> Tabel Harga</h1>
<table class="table table-hover">
<th>Konsentrasi</th>
<th>Biaya /Semester (1 - 4)</th>
<th>Biaya /Semester (5 - 6)</th>
<th>Total Biaya</th>
<script>
var kons = ["Teknik Informatika", "Administrasi Bisnis", "Administrasi Perkantoran", "Komputerisasi Akuntansi", "Hubungan Masyarakat"];
var bs14 = [8500000, 7500000, 7350000, 8000000, 8250000];
var bs56 = [7500000,6500000, 6350000, 7000000, 7250000];
for(i=0;i<=4;){
var hasil = (bs14[i] * 4) + (bs56[i] * 2);
document.write("<tr><td>" + kons[i] + "</td><td> Rp." + bs14[i] + "</td><td> Rp." + bs56[i] + "</td><td> Rp." +hasil+"</td></tr>");
i++;
}
</script>
</table>
</div>
</div>
</body>
</html>