<CustomAction
Location="ScriptLink"
ScriptBlock="
//Function that Dynamically Loads the Javascript
function loadScript(scriptSrc, callbackFunction) { //Gets a reference to the Head section, where the Script tage will be inserted
var headSection = document.getElementsByTagName('head')[0];
//Creates a new Script tag
var script = document.createElement('script'); script.type = 'text/javascript';
//Sets the source for the script tag to our external library
script.src = scriptSrc;
// most browsers
script.onload = callbackFunction;
// Fix to ensure support for IE 6-7
script.onreadystatechange = function() { if (this.readyState == 'complete') { callbackFunction();
}
}
//Adds the section to the header
headSection.appendChild(script);
}
//Function to test that JQuery has loaded successfully
//This should be replaced with your own function calls
function runScript() { $(document).ready(function() { alert('jQuery is loaded!!'); }); }
//Important, this ensure the scripts execute after SharePoint has done everything it needs to.
_spBodyOnLoadFunctionNames.push('loadScript(\'http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js\', runScript)'); " Sequence="101">
</CustomAction>