Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] global vars prob


  • From: borchers at tridem.de (Michael Borchers)
  • Subject: [Javascript] global vars prob
  • Date: Wed Sep 28 09:18:07 2005

i am creating new elements within for()
with a starting var named "id"
 
 id = ordersNumRows;
 
 for(o=0;o<ordersNumRowsAdded;o++)
 {
...
  inputProductsPrice.setAttribute("id","products_id[" + id + "][products_price]");
  inputProductsPrice.onfocus=function() { products_price_return(id); };
...
id++;
}
 
the shown ID in the attribute works fine => 0, 1, 2, ... X (let's say 10)
 
but when the function is called, the id always is the highest value at the end of for, f.e. 10
 
how do these globals work, do i have to add them with a " + " or similar?
 
-------------- n?chster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: http://lists.LaTech.edu/pipermail/javascript/attachments/20050928/a80ca19d/attachment.html