views:

98

answers:

1

Is there some equivalent to jQuery's getScript in Prototype ?

+2  A: 
var head;

var script;

head = $$('head')[0];
if (head)
{
    script = new Element('script', { type: 'text/javascript', src: 'dynamic.js' });
    head.appendChild(script);
}
XGreen
Im loading this script after a user interaction, so I dont think inserting in head would execute it, would it ?Anyway, I've used native JS to add this. Hopefully this works in all browsers.var fileref = document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", "http://domain.com/script.js");
Phonethics