<html>
<head>
<title>Menampilkan Hari</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function test()
{
hari = prompt("Masukkan Kode Hari (1-8)")
switch(hari)
{
case "1" :
document.write("SENIN")
break
case "2" :
document.write("SELASA")
break
case "3" :
document.write("RABU")
break
case "4" :
document.write("KAMIS")
break
case "5" :
document.write("JUMAT")
break
case "7" :
document.write("SABTU")
break
case "8" :
document.write("MINGGU")
break
default :
document.write("PERBAIKI CARA INPUT MU BRO")
}
}
</SCRIPT>
<body>
<input type ="button" name="button1" value="Switch" onclick=test()>
</body>
</html>
ScreenShoot :
Tampilan Awal
Setelah Tombol Di Klik
Output
Tidak ada komentar:
Posting Komentar