Injects a script tag into the head section of the document, pointing to the src specified.
Syntax
var myScript = Asset.javascript(source[, properties]);
Arguments
source - (string) The location of the JavaScript file to load.
properties - (object, optional) Additional attributes to be included into the script Element; this is the same as the second argument you might pass to including the Element constructor with the exception of Events (see note)
onLoad - (function) A function that will be invoked when the JavaScript is loaded.
document - (object, defaults to document) The document which the JavaScript should be injected in.
Returns
(element) A new script Element.
Examples
var myScript = Asset.javascript('/scripts/myScript.js', {
id: 'myScript',
onLoad: function(){alert('myScript.js is loaded!');
}});
Note
WARNING: DO NOT use addEvent for load on the returned element, give it as onLoad in the properties argument.
properties - (object) Some additional attributes you might want to add to the link Element; this is the same as the second argument you might pass to including the Element constructor. For instance you might specify a title attribute or perhaps an id.
document - (object, defaults to document) The document which the link element should be injected in.
Returns
(element) A new link Element.
Examples
var myCSS = Asset.css('/css/myStyle.css', {id: 'myStyle', title: 'myStyle'});