Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
64
rated 0 times [  67] [ 3]  / answers: 1 / hits: 22534  / 13 Years ago, mon, august 15, 2011, 12:00:00

I have something like this in a JavaScript control, how does one subscribe to this event?



if(typeof(pnlDialog.onclose) == 'function')
pnlDialog.onclose();


I thought it was something like this, but haven't been successful.



var mycontrol = document.getElementById('myDialog');
mycontrol.attachEvent('onclose', function()
{
alert('closed');
});

More From » javascript

 Answers
-6

Looks like it's not using events at all, its just using a late bound function. Therefore use this:



var mycontrol = document.getElementById('myDialog');
mycontrol.onclose = function(){
alert(Closed);
}

[#90614] Friday, August 12, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
parker

Total Points: 259
Total Questions: 109
Total Answers: 97

Location: Zambia
Member since Thu, Jun 25, 2020
4 Years ago
;