Reputation: 4324
i have an confirmation box where user can select OK to continue or Cancel to close box and stay on same page. Problem is that in all browsers except for Opera if I click cancel in the confirmation box, then the box closes and the user stays on the same page which is fine, but in Opera if I click on cancel it would close the page as well.
What do I need to include so that in Opera if I click cancel in the confirmation box, it would close the box but does not close the page?
below is code:
function showConfirm(){
var confirmMsg=confirm("Make sure that your details are correct, once you proceed after this stage you would not be able to go back and change any details towards your Session." + "\n" + "\n" + "Are you sure you want to Proceed?" + "\n" );
if (confirmMsg==true)
{
submitform();
}else{
parent.close();
}
}
Thanks
Upvotes: 0
Views: 2526
Reputation: 9646
Clicking cancel on the confirm box should close your confirmation window anyway, which is what I presume you want to do
Upvotes: 0
Reputation: 4346
It seems to me that the else
block is unneeded as the parent of an element can be window
. That's why the page is closed.
I'm not sure what did you want to close with that parent.close()
function showConfirm(){
var confirmMsg=confirm("Make sure that your details are correct, once you proceed after this stage you would not be able to go back and change any details towards your Session." + "\n" + "\n" + "Are you sure you want to Proceed?" + "\n" );
if (confirmMsg)
{
submitform();
}
}
Upvotes: 3