I am learning java script watching tutorials and have created this simple code. The function executes 50%. When I click the button to close the window, the window.confirm appears and when I click okay, the window.close() should execute and close the window. The window does not close. Any suggestions or comments would be greatly appreciated. The simple code is below.
Code:
<html>
<title>Pop-up Ad Example</title>
<head>
<Script language="javascript">
function closeWindow(form){
window.confirm("Are you sure you want to close this page?");
window.close();
}
</script>
</head>
<body>
<form name="myform">
<input type="button" name="button" value="Close this Window" onClick="closeWindow(this.form)"></br>
</form>
</body>
</html>
Comment