Transform any JavaScript function into a page event

Posted by Laith on Stack Overflow See other posts from Stack Overflow or by Laith
Published on 2010-05-07T19:09:18Z Indexed on 2010/05/07 19:18 UTC
Read the original article Hit count: 303

Filed under:
|

I need to be able to achieve the following (one way or another):

function ShowContent() {}

document.onShowContent = function ()
{
     // anything I want to happen....
}

What I'm trying to do is to add a kind of listener to me Advertisement code on the page that will auto refresh the ad slot when a specific function is called. Instead of having that function "ShowContent()" directly refresh the ad code, I want the ad code to refresh if it detects that "ShowContent()" has been called.

Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about events