Tuesday, November 18, 2008

Is Dirty page Implementation : javascript

window.onbeforeunload = function (oEvent)
{
var isdirty = document.getElementById("ctl00_IsDirty");
if(isdirty.value=="false")
{

}
else
{
if(!oEvent) oEvent = window.event;
oEvent.returnValue = 'ALL your recent changes will be LOST unless your click CANCEL.';
UnsetDirty();
}

}
function UnsetDirty()
{
var isdirty = document.getElementById("ctl00_IsDirty");
isdirty.value = false;

}
function SetDirty()
{

var isdirty = document.getElementById("ctl00_IsDirty");
isdirty.value = true;

No comments: