To overcome this drawback, a developer can use an array i.e. _spBodyOnLoadFunctionNames
The only thing we need to do is to pass the function's name using .push method.
Example:
<script language="javascript">
_spBodyOnLoadFunctionNames.push("TestFunction");
function TestFunction()
{
alert("hello");
}
</script>
We can use above script in master page, aspx page, content editor web part, visual web part as per the need.
Contact Me or post a comment for any technical help related with SharePoint 2010.
No comments:
Post a Comment