Element beforeunload

Element beforeunload

hi all,
      Can u tell me is it possible for  when am unload the div i want confirm message .its should be common method.

ex:
$('#divid').load('test.php');

<div id="divid" >some message </div>

here before replace the content .i want cofirm message alert("you want replace the content');
by
M.Maheshrajkumar