I would like to know is it possible to save some, for example,simplemath.js file with
function ADD(a, b)
{
return a + b;
}
simple function, run opera's or some other browser's javascript console, include somehow this (simplemath.js) file, call ADD(2, 5), and get a result in console or execute javascript code on current web page and manipulate with it's content. How can I do that? How can I use javascript functions from external files in web-browser's javascript console?
// EDITS
simplemath.js is just local file, somewhere on hard drive (c:\temp\simplemath.js), no localhost web servers running. I want to run scripts from it on any web page and get result similar to typing javascript: function ADD(a, b){return a+b;} alert(ADD(1, 41);) in browsers address bar, but via console, and load ADD function from external file.
simplemath.jsfile located? Somewhere on the web, or on your disk? Do you have a webserver running on your localhost?c:\temp\simplemath.js), no web servers running. I want to run scripts from it on any web page and get result similar to typingjavascript: function ADD(a, b){return a+b;} alert(ADD(1, 41);)for example in browsers address bar, but from console, and load this function from external file.