Quote:
Originally Posted by Analogus
..
How do you call an external *.js-script from within an function?
Script is in say /Data/.../scripts/
A.
|
You can do it like this:
Code:
var myCode, codePath, f, value1, value2;
codePath = "/Data/.../scripts/";
//load js-code
myCode = Core.io.getFileContent(codePath);
//create new Function form myCode passing two paramters "param1/param2" used in external code
f = new Function("param1,param2", myCode);
// set parameters if needed
value1 = something;
value2 = anotherting;
// execute the function
try {
f(value1,value2);
}catch (ignore) {}
Check prsp.js code and read here:
http://de.selfhtml.org/javascript/sp...funktionen.htm
HTH
Mark