maybe my question is very simple but i am new at HTML and JavaScript.
I want to learn window.close() and window.stop() ,
so i tried it in a simple HTML page. But there is a problem, i'am using my function in a tag. and window.stop() does not stop the operation. I want to stop the redirection if confirm dialog not true. How can i fix this problem?
HTML FILE:
<html>
<head>
<title> My page </title>
<script src="my_javascript_file.js"></script>
</head>
<body>
<a href = "http://www.google.com" onclick="whereAreYouGoing()">Go</a>
</body>
</html>
my_javascript_file.js:
function whereAreYouGoing(){
var exit = confirm("Are You Want to Sure to Leave?");
if(exit){
window.close();
}
else
window.stop();
}
Aucun commentaire:
Enregistrer un commentaire