Welcome to MSDN Blogs Sign in | Join | Help
SharePoint JavaScript – Page Load Add function: _spBodyOnLoadFunctionNames

In most cases SharePoint pages are based on a master page that contains the “body” element. These content pages can’t directly add a function to the body’s onload event. In order to work around this limitation, SharePoint provides the “_spBodyOnLoadFunctionNames” array. When the body is loaded, the onload event handler executes each function whose name is contained in this array. We added “FunctionName” to the array so that it would run when the body’s onload event fires.

<script language="javascript">  
    _spBodyOnLoadFunctionNames.push("FunctionName");  
    function FunctionName()  
    {  
        // Code  
    }  
</script> 

Posted: Monday, June 22, 2009 10:27 AM by itsmeskv
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker