Adding Javascript Functions to a Master Page OnLoad Event

There are a few ways of doing this but the best way I found was to use the push method of the _spBodyOnLoadFunctionNames array e.g.

function createprintpage(){
..
}
_spBodyOnLoadFunctionNames.push(“createprintpage”);

This array allows the addition of a function to the onload event without over-writing required functions by adding a javascript call directly to the master page body onload

Advertisements

3 thoughts on “Adding Javascript Functions to a Master Page OnLoad Event

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s