Hello,
I am trying to figure out how to programmatically add an event handler to a JavaScript object. More specifically, I am trying to add an event handler to the onunload event of a window object. I am trying it like so with out any luck:
var url = "www.somelocation.com";
var specs = "location=0,menubar=0,status=0,titlebar=0,toolbar=0";
var dialogWindow = window.open(url, "dialog", specs, true);
dialogWindow.onunload += myEventHandler;
function myEventHandler(e)
{
// Do stuff
}
I'm guessing my syntax is incorrect. However, I cannot seem to find any documentation regarding this. Can someone please help me?
Thanks,