<html>
<head>
<script type="text/javascript">
<!--
function confirmation() {
var answer = confirm("Ingin meninggalkan situs ini?")
if (answer){
alert("Bye bye!")
window.location = "http://www.google.com/";
}
else{
alert("Terima Kasih!")
}
}
//-->
</script>
</head>
<body>
<form>
<input type="button" onclick="confirmation()" value="Leave Tizag.com">
</form>
</body>
</html>
<head>
<script type="text/javascript">
<!--
function confirmation() {
var answer = confirm("Ingin meninggalkan situs ini?")
if (answer){
alert("Bye bye!")
window.location = "http://www.google.com/";
}
else{
alert("Terima Kasih!")
}
}
//-->
</script>
</head>
<body>
<form>
<input type="button" onclick="confirmation()" value="Leave Tizag.com">
</form>
</body>
</html>
Tags:
Tutorial Javascript