Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi All, Very Good Morning..

I got a small problem when handling the Unbeforeload.

My Problem: Based on Some count i need to show a pop-up window and if the count equals, I need to cancel the pop-Up.

Can i handle "X" button in Pop_Up window. If the user clicks on it, is it possible to show any error Message?

Requirement: If the user clicks on "X" button (Top-Right Corner) in Pop_up Window, it should act like Cancel button. As of now, it is submitting like "OK" button


Sample JS Code:
JavaScript
window.onbeforeunload = function () {
        window.returnValue = document.getElementById("hidAttachedCount").value;
        if (window.returnValue == "3") {
            CausesValidation = "false";
        }
        else {
            return "Did you save your stuff?";
        }
    }
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900