Monday, 15 June 2015

DOM

<!DOCTYPE html>
<html>
<head>
<style>
p {
width:100px;
}

   .err {
color:red;
font-style:italic;
font-size:10px;
   }
 </style>
 <script>
   function cek(){
status_oke = true;
// cek NIM tidak boleh kosong
if (surat.nama.value.trim() == ""){
 document.getElementById("err_nama").innerHTML="Nama Harus Diisi";
 status_oke = false;
} else {
 document.getElementById("err_nama").innerHTML="";
}  
// cek nama tidak boleh kosong
if (surat.email.value.trim() == ""){
 document.getElementById("err_email").innerHTML="Email Harus Diisi";
 status_oke = false;
} else {
 document.getElementById("err_email").innerHTML="";
}
// cek komentar tidak boleh kosong
if (surat.komen.value.trim() == ""){
 document.getElementById("err_komen").innerHTML="komentar Harus Diisi";
 status_oke = false;
} else {
 document.getElementById("err_komen").innerHTML="";
}
     return status_oke;
   }

function validateForm()
{
var x=document.forms["surat"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
 {
 alert("Not a valid e-mail address");
 return false;
 }
}
function tutup_form_komen(){
document.getElementById("komen").innerHTML="";
  }
  function form_komen(){
    cForm  = "<form action='#' method='post' onsubmit='return cek(), validateForm();' name='surat'>";
    cForm += "email : <input type='text' name='email' /><span class = 'err' id='err_email' ></span><br/>";
cForm += "Nama : <input type='text' name='nama' /><span class = 'err' id='err_nama' ></span><br/>";
    cForm += "Komentar : <br/>";
    cForm += "<textarea name='komen'></textarea><span class = 'err' id='err_komen' ></span><br/>";
    cForm += "<br/><input type='submit' value='Publish' />";
    cForm += "</form>";
    document.getElementById("komen").innerHTML=cForm;
  }
</script>
</head>
<body>
  <input type="button" value="Komen" onClick="form_komen()">
  <input type="button" value="Tutup Komen" onClick="tutup_form_komen()">
  <div id="komen"></div>

</body>
</html>

Monday, 8 June 2015

Penggunaan function javascript

<!DOCTYPE html>
<html>
<head>
<script language="javascript">
function hargaKamar(){
f1.harga.value=f1.jenis.value;
 }
function total1(){
f1.tot1.value=(parseInt(f1.harga.value))*(parseInt(f1.hari.value));
 }
 function hargaKamar1(){
f1.harga1.value=f1.meeting.value;
 }
 function total2(){
f1.tot2.value=(parseInt(f1.harga1.value))*(parseInt(f1.hari1.value));
 }
 function hargaKamar2(){
f1.harga2.value=f1.extra.value;
 }
 function total3(){
f1.tot3.value=(parseInt(f1.harga2.value))*(parseInt(f1.hari2.value));
 }
  function hargaKamar3(){
f1.harga3.value=f1.air.value;
 }
 function total4(){
f1.tot4.value=(parseInt(f1.harga3.value))*(parseInt(f1.hari3.value));
 }
 function Brutto(){
f1.brutto.value=parseInt(f1.tot1.value)+parseInt(f1.tot2.value)+parseInt(f1.tot3.value)+parseInt(f1.tot4.value);
 }
  function totaldisk(){
if (f1.diskon[0].checked){
f1.totdisk.value=(f1.diskon[0].value)*(f1.brutto.value);
}
else if(f1.diskon[1].checked){
f1.totdisk.value=f1.diskon[1].value*f1.brutto.value;
}
else{
f1.totdisk.value=f1.diskon[2].value*f1.brutto.value;
}
  }
  function Netto(){
  f1.netto.value=parseInt(f1.brutto.value)-parseInt(f1.totdisk.value);
  }
  function total(){
  f1.kembali.value=parseInt(f1.bayar.value)-parseInt(f1.netto.value);
  }
 </script>
</head>
<body>
<table border="1px">
<form name="f1">
<tr>
<th>Jenis Kamar</th>
<th>Harga</th>
<th>Banyak Hari</th>
<th>Total Biaya kamar</th>
</tr>
<tr>
<th><select name="jenis" onChange="hargaKamar()">
<option value="0">.::PILIHAN::.</option>
<option value="100000">Standar</option>
<option value="200000">VIP</option>
<option value="300000">President Suite</option>
</select>
</th>
<th><input type="text" name="harga" disabled /> </th>
<th><input type="text" name="hari" onChange="total1(),Brutto()"></th>
<th><input type="text" name="tot1" value="0" disabled></th>
</tr>
<tr >
<td colspan="4">Fasilitas Tambahan</td>
</tr>
<tr>
<td><input type="checkbox" name="meeting" value="2000000" onChange="hargaKamar1()"/>Meeting</td>
<th><input type="text" name="harga1" value="0" disabled /> </th>
<th><input type="text" name="hari1" onChange="total2(),Brutto()"></th>
<th><input type="text" name="tot2" value="0" disabled></th>
</tr>
<tr>
<td><input type="checkbox" name="extra" value="100000" onChange="hargaKamar2()"/>Extra Bed</td>
<th><input type="text" name="harga2" value="0" disabled /> </th>
<th><input type="text" name="hari2" onChange="total3(),Brutto()"></th>
<th><input type="text" name="tot3" value="0"disabled></th>
</tr>
<tr>
<td><input type="checkbox" name="air" value="50000" onChange="hargaKamar3()" />Air Panas</td>
<th><input type="text" name="harga3" value="0" disabled /> </th>
<th><input type="text" name="hari3" onChange="total4(),Brutto()"></th>
<th><input type="text" name="tot4" value="0" disabled></th>
</tr>
<tr >
<td colspan="4">PEMBAYARAN</td>
</tr>
<tr >
<td colspan="3">Total Biaya/Brutto</td>
<td><input type="text" name="brutto"  value="0" disabled></td>
</tr>
<tr >
<td colspan="3">Diskon <input type ="radio" name="diskon" value="0" onChange="totaldisk(),Netto()">No Diskon
<input type ="radio" name="diskon" value="0.1" onChange="totaldisk(),Netto()">10%
<input type ="radio" name="diskon" value="0.2" onChange="totaldisk(),Netto()">20%</td>
<td><input type="text" name="totdisk"  disabled></td>
</tr>
<tr >
<td colspan="3">Netto</td>
<td><input type="text" name="netto"  value="0" disabled></td>
</tr>
<tr >
<td colspan="3">Pembayaran</td>
<td><input type="text" name="bayar"  value="0" onChange="total()"></td>
</tr>
<tr >
<td colspan="3">Kembali</td>
<td><input type="text" name="kembali"  value="0" disabled></td>
</tr>
</form>
</table>
</body>
</html>


Monday, 1 June 2015

Cara Hosting Website menggunakan idhostinger

buka idhostinger.com

isi bagian subdomain

 setelah berhasil akan muncul seperti di bawah ini

cek/ melakukan kofirmasi pendaftaran