from previous help I am using something like this:
(function (global) {
// your code here
global.myGlobalVar = myVar
}(this));
which works great for variables, but how do I do it for functions?
For example I tried this:
(function (global) {
function something()
{
// do something, return something
}
global.something()= something();
}(this));
but that does not work :(
How do I get it to work with functions?
Thanks!
EDIT:
Please note that this is being called in a html page, first I do this:
<script language="Javascript" src="four.js">
then
<body onload="javascript:something()">
onload, you should not writejavascript:(it is sometimes used in<a href="">). You just simply write the function name you want to execute.