Senin, 19 April 2010

ENTRY DATA KARYAWAN

<html>
<head>
<title>Entri data pegawai</title>
<script language="javascript" type="text/javascript">
<!--

var DBPegawai = new Array();
function Pegawai(Fields_NIP,Fields_Nama,Fields_Gaji_per_jam,Fields_Jam_kerja,Fields_Gaji_total)
{


this.NIP = Fields_NIP;
this.Nama = Fields_Nama;
this.Gaji_per_jam = Fields_Gaji_per_jam;
this.Jam_kerja = Fields_Jam_kerja;
this.Gaji_total = Fields_Gaji_total;
}


function inputPegawai()

{

while ( Nip=window.prompt("ketikan NIP(Nomor Induk Pegawai)\n\n Click'cancel' untuk berhenti !!."))
{
Nama =window.prompt("Nama Pegawai:");
Gaji_per_jam = parseInt(window.prompt("Gaji per jam"));
Jam_kerja = parseInt(window.prompt("Jumlah jam kerja:"));
Gaji = Gaji_per_jam * Jam_kerja;
DBPegawai[DBPegawai.length] = new Pegawai(Nip,Nama,Gaji_per_jam,Jam_kerja,Gaji);
}
ShowPegawai();
}
function ShowPegawai()
{
document.write("<table border='1'>"+"<tr>"+"<th>NIP</th> <th>Nama</th> <th>Gaji per jam</th> <th>Jam kerja</th>"+
"<th>Gaji </th>"+"</tr>");
for (i=0; i < DBPegawai.length;i++)
{
document.write("<tr>"+
"<td>"+DBPegawai[i].NIP+"</td>"+
"<td>"+DBPegawai[i].Nama+"</td>"+
"<td align='right'>"+DBPegawai[i].Gaji_per_jam+"</td>"+
"<td align='right'>"+DBPegawai[i].Jam_kerja+"</td>"+
"<td align='right'>"+DBPegawai[i].Gaji_total+"</td>"+
"</tr>");
}
document.write("</table>");
}


//-->
</script>
</head>
<body onload="inputPegawai();">
</body>
</html>

HASILNYA :









Tidak ada komentar:

Poskan Komentar