Quote:
Originally Posted by broli85
how do you include a javascript file A in another javascript file B inorder to be able to use the functions in A from B.
i thought the code in javascript file B would be like this...
<script src="chrome://followmylink/contents/fileA.js">
...code in B where i will be using the functions from B ...
</script>
The code in the B file goes out side fo the script tag from the A file. See below.
- <script src="chrome://followmylink/contents/fileA.js"></script>
Quote:
Originally Posted by broli85
Also is there a way how you would define a class?
-
<script>
-
function myClassFile(){
-
-
this.someVar = 'This is a String';
-
-
this.someMethod = new function(){
-
.....
-
.....
-
}
-
}
-
<script/>
-
Quote:
Originally Posted by broli85
If so how should I call it from file A if I put it in file B
-
<script>
-
-
document.write('<script src="chrome://followmylink/contents/fileA.js"></script>');
-
-
-
var myClassInstance = new myClassFile();
-
-
myClassInstance.someMethod();
-
-
<script/>
-