]|V|[agnus
07-08-2004, 09:51 PM
var d = document;
var f = d.forms[0];
function doSomething() {
f.style.marginRight = "3em";
}
That function is retarded, but the point is to illustrate what I tried to setup global variables that I reuse frequently in scripts, but it doesn't seem to work. I read that all variables are global in JS unless declared within a function, in which case they are local to that function. So what is wrong with the above then?
var f = d.forms[0];
function doSomething() {
f.style.marginRight = "3em";
}
That function is retarded, but the point is to illustrate what I tried to setup global variables that I reuse frequently in scripts, but it doesn't seem to work. I read that all variables are global in JS unless declared within a function, in which case they are local to that function. So what is wrong with the above then?