Connecting Tech Pros Worldwide Help | Site Map

fixing a variable's value in a function

Newbie
 
Join Date: Dec 2008
Posts: 7
#1: Dec 16 '08
Hi,

I would like to assign an integer to a add() through a variable. So I initially wrote this.


Expand|Select|Wrap|Line Numbers
  1. var i=0;
  2. name.onblur = function {add(i)};
  3. i++;
if I created like 4 add(i), then i = 3. Then, if I onblur my first add(i), which I want it to be add(0);, it will instead add(3).

In other words, how do I make sure I put a permanent value into a function through a variable?

I hope I'm clear enough.

Thank you.
Reply With Quote
Reply