Wednesday, July 29, 2009

Make javascript variables global

To make a variable just define it outside the scope of your functions
Eg:
var myvar=5;
fun();
myvar=1;
fun();
function fun()
{ //code goes here.
alert(myvar);
}

No comments:

Post a Comment