sharing variables between javascript functions
Moderator: General Moderators
sharing variables between javascript functions
i have two javascript fuctions in my page and i want to have access to some variables of the first function within second function. how shoud i do that?
Re: sharing variables between javascript functions
Define variable outside the functions:
Code: Select all
var my_variable = 'abc';
function a() { my_variable = 3; }
function b() { alert(my_variable); }Re: sharing variables between javascript functions
thanks for your reply...but my problem was another thing but i discribed it improperly...anyway i found solution for my problem.