Jump to content

Problem


immad

Recommended Posts

Hello,

this is my java script coding and its working fine.its show the meessage box.i just want a little thing that when i click to browser X button its show me this coding message.right now i make a button in aspx page and its show message.but i want to click browser X button and Page show me this java script coding Message.

<script src="scripts/jquery-1.4.3.min.js" type="text/javascript"></script>

<script type="text/javascript">

$(document).ready(function (){$("#btnShowSimple").click(function (e){ShowDialog(false);e.preventDefault();});

$("#btnShowModal").click(function (e){ShowDialog(true);e.preventDefault();});

$("#btnClose").click(function (e){HideDialog();e.preventDefault();});

$("#btnSubmit").click(function (e){var brand = $("#brands input:radio:checked").val();$("#output").html("" + brand);HideDialog();e.preventDefault();});});

function ShowDialog(modal){$("#overlay").show();$("#dialog").fadeIn(300);

if (modal){$("#overlay").unbind("click");}else{$("#overlay").click(function (e){HideDialog();});}}

function HideDialog(){$("#overlay").hide();$("#dialog").fadeOut(300);} function btnShowSimple_onclick() {

}

</script>

please help me out

Thanks in advance

Link to comment
Share on other sites

That code isn't going to stop the browser from closing. They will click the close button and the code will run to show the dialog, but the browser will still close before they see anything. If you want to pause the browser from closing then you need to use an alert or something like that. But even then you won't be able to stop them from closing the browser, they will just see a message and when they click OK the browser will close. You can use the window.onunload event to set that up, but that event will also fire when they navigate away from the page. There isn't a specific event for when they close a page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...