[Javascript] global vars prob
Michael Borchers
borchers at tridem.de
Wed Sep 28 09:19:05 CDT 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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050928/a80ca19d/attachment.htm>
More information about the Javascript
mailing list