Quantcast
Channel: The New Dawn » programming
Viewing all articles
Browse latest Browse all 8

JavaScript pageLoad() for MasterPage and ContentPage

$
0
0

Sometimes, we need to use pageLoad() function in both MasterPage and ContentPage to get something done. But, if we add two function with such same name, that function residing in ContentPage will be ignored by the browser. To correct this behaviour, we need to extend pageLoad() function in MasterPage as follows:

In MasterPage

function pageLoad(sender, args)
{
...
// ... do my MasterPage JavaScript stuff...
...
if (window.contentPageLoad) {
window.contentPageLoad(sender, args);
}
}

In ContentPage

function contentPageLoad(sender, args)
{
// do something
}

Credit goes to devioblog.


Viewing all articles
Browse latest Browse all 8

Trending Articles