Wednesday, April 21, 2010
record
Posted by Dendi Prana Yudha in
Kuliah,
Web
<html>
<head>
<title>Membuat Rekaman Objek</title>
</head>
<body>
<script language="JavaScript">
<!--
var Record = new Array();
function Mahasiswa (npm,nama,prodi,jenjang)
{
this.npm = npm;
this.nama = nama;
this.prodi = prodi;
this.jenjang = jenjang;
this.LihatRecordMahasiswa = LihatRecordMahasiswa;
}
function LihatRecordMahasiswa()
{
document.write("<td>" + this.npm + "</td>");
document.write("<td>" + this.nama + "</td>");
document.write("<td>" + this.prodi + "</td>");
document.write("<td>" + this.jenjang + "</td>");
}
Record[0] = new Mahasiswa("43E001", "Dani", "TI", "SI");
Record[1] = new Mahasiswa("43E001", "Doni", "TI", "SI");
Record[2] = new Mahasiswa("43E001", "Dina", "TI", "SI");
Record[3] = new Mahasiswa("43E001", "Dini", "TI", "SI");
document.write("<table border = '1'>");
document.write("<th>npm</th> <th>nama</th>");
document.write("<th>prodi</th> <th>jenjang</th> <br>");
for (i=0; i<Record.length; i++)
{
document.write("<tr>");
Record[i].LihatRecordMahasiswa();
document.write("</tr>");
}
document.write("</table> <br>");
//-->
</script>
</body>
</html>
0 komentar:
Post a Comment
Tinggalkan Komentar Disini