Wednesday, October 28, 2015

Tugas 4 Pemrograman Web

Buat file web javascript untuk konfirmasi 

<html>
<head>
<meta/>
<title>Tugas4_JavaScript_Ayunda_1306470211</title>
</head>

<body>
<script>
function konfirmasi() {
var npm = document.forms["coba"]["npm"].value;
if(npm == null || npm == "")
{
alert("NPM tidak boleh kosong");
return false;
} else if(npm != null)
{
if(confirm("NPM Anda " + npm + "?")) {
alert("NPM anda adalah" + npm );
}
else
{
return false;
}
}
}
</script>
<form name="coba" method="post" onSubmit="return konfirmasi()">
<label>NPM :</label><input type="text" name="npm" />
<input type="submit" name="submit" value="Submit" />
</form>
</body>

</html>

Hasilnya:

No comments:

Post a Comment