well i need to call a function defined in another javascript file(file 2) in file 1. i just wrote in file 1
var ball;
var ab=document.getElementById("abcd");
funcname();
now in the other file(file 2)
function funcname()
{
ball=ab.width; //line 2
}
now it shows an error like cannot find ab when it comes to line 2
i cant understand why this happens... and i tried this and this worked
in file 1
var ball;
var ab=document.getElementById("abcd");
funcname(ball,ab);
in the other file (file2)
function funcname(ball,ab)
{
ball=ab.width; //line 2
}