Home > Uncategorized > Adding JavaScript function to SharePoint application pages

Adding JavaScript function to SharePoint application pages

Hi there, just a quick and simple posting today. At some point you may need to call some custom java script when your page loads in SharePoint. To have your custom function called during the onLoad event simply add the _spBodyOnLoadFunctionNames.push method. to your script block

 

Sample script block added to your application page in SharePoint…

<script type="text/javascript">

_spBodyOnLoadFunctionNames.push(

"someFunction");

function someFunction() {

    alert(

"Hello world!)";

}

</script>


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.