Modul 6

LAPORAN PRAKTIKUM WEB 1
MODUL 6
"JAVA SCRIPT (PEMILIHAN,PENGULANGAN,ARRAY)"


Nama  : Yayat Supriatna
Nim    : 20160910098
Kelas  : SIC-2016


Postest :
Buatlah Matrik papan catur !

Syntax :
<html>
 <head>
  <title>Program Matrik Pada Papan Catur</title>
 </head>
<script language="javascript">
 function catur(){
  document.write('<h1 align="center">Program Matrik Pada Papan Catur</h1>');
  document.write('<table border="1" align="center">');
  for (i = 1;i <= 5; i++){
   for (j = 1;j <= 5; j++){
    if((i + j) % 2 == 1)
    document.write('<td>' + "["+ i + j +"]" + '</td>');   
    else
    document.write('<td bgcolor="black">'+"["+ i + j +"] " + '</td>')
   }
   document.write("</tr>");
  }
 }
</script>
<body onload="catur()">
</body>
</html> 


Tugas :
buatlah Program java script berikut!
NO
NAMA BARANG
HARGA
DISCOUNT
1
Televisi
1.500.000
10%
2
Kulkas
1.850.000
8%
3
Mesin Cuci
2.150.000
15%
  Syntax :
<html>
 <head>
  <title>Menampilkan Produk Elektronik</title>
 </head>
<script language="javascript">
 function validasi()
 {
  barang=document.form.data.value;
  
 switch (barang)
 {
  case '1' : document.write("
Nama Barang  : Televisi 21inc" + 
          "
Harga        : Rp. 1.500.000" +
          "
Discount 10% : Rp. 150.000" +
          "
Harga Bayar  : Rp. 1.350.000");
          break;
  case '2' : document.write("
Nama Barang  : Kulkas" + 
          "
Harga        : Rp. 1.880.000" +
          "
Discount 8%  : Rp. 148.000" +
          "
Harga Bayar  : Rp. 1.702.000");
          break;
  case '3' : document.write("
Nama Barang  : Mesin Cuci" + 
          "
Harga        : Rp. 2.150.000" +
          "
Discount 15% : Rp. 322.500" +
          "
Harga Bayar  : Rp. 1.827.500");
          break;
  default : document.write("Angka yang dimasukan salah");
  }
}  
</script>
<body="center">
 <h3>Daftar Harga Barang</h3>
 1. Televisi 21 inc</br>
 2. Kulkas</br>
 3. Mesin Cuci</br></br>
 
 <form name="form">
 Ketik nomor barang <input type="text" name="data"></br>
 <input type="button" value="Proses" onClick="validasi()">
 </form>
</body>
</html> 
 
Hasil Run :
 

 
 
 Termkasih Semoga Bermanfaat :)
 

Komentar

Postingan populer dari blog ini

PENGENALAN VIRTUAL LAN

Laporan modul 7 pbo

Laporan modul 5 pbo