Friday, October 29, 2010

SharePoint's _spBodyOnLoadFunctionNames function

The Body onLoad event for the SharePoint master page runs the _spBodyOnLoadFunctionNames function. If you need to run any other javascript at page load, push function name this function. As an example:

function setSearchBoxFocus() // set focus to search textbox
{
document.getElementById('ctl00_ctl00_SearchBox_S3A1EF0A8_InputKeywords').focus();
}

_spBodyOnLoadFunctionNames.push("setSearchBoxFocus");

No comments:

Post a Comment