ASP.NET Post-Back and window.onload
<p>I got a function which checks if some input fields are changed:</p>

<pre><code>var somethingchanged = false;
$(".container-box fieldset input").change(function() {
   somethingchanged = true;
});
</code></pre>

<p>And a function which waits on <code>window.onload</code> and fires this:</p>

<pre><code>window.onbeforeunload = function(e) {
    if (somethingchanged) {
        var message = "Fields have been edited without saving - continue?";
        if (typeof e == "undefined") {
            e = window.event;
        }
        if (e) { 
             e.returnValue = message;
        }
        return message;
    }
}
</code></pre>

<p>But if I edit some of the fields and hit the save button, the event triggers, because there is a post-back and the fields have been edited. Is there anyway around this, so the event does not fire upon clicking the save button?</p>

<p>Thanks</p>
