CHAPTER - 14

Confirm in javascript


<html>

<head>
<script type="text/javascript">

function confirmation() {
var answer = confirm("Do you want to leave this page?")
if (answer==true){
window.location = "http://www.google.com/";
}
else{
alert("Thanks for sticking around!")
}
}
</script>
</head>
<body>
<form>
<input type="button" onclick="confirmation()" value="Leave This Page">
</form>
</body>
</html>

Comments

Popular posts from this blog

CHAPTER - 18