View Single Post
Old 03-31-2012, 11:31 AM   #3586
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 854
Karma: 327896
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
Quote:
Originally Posted by Analogus View Post
..
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

Last edited by Mark Nord; 03-31-2012 at 03:29 PM. Reason: added quote of question due to new page
Mark Nord is offline   Reply With Quote