[Javascript] global vars prob?!

Flavio Gomes flavio at economisa.com.br
Fri Feb 10 08:49:19 CST 2006


Could we see some more work in progress of your code?
We dont have the "/products_price_return/" function

Could you send us a minimal /html/ attached version of your code?

Michael Borchers escreveu:

> i dynamically create a textarea in a for() like this:
>  
> var offersNumRows = 2
>  
> var offersNumRowsAdded=4 (f.e.)
>  
>  for(o=0;o<offersNumRowsAdded;o++)
>  { 
>
>       var numRow = offersNumRows + o;
> ...
>  
>   var inputProductsDescription = document.createElement("textarea");
>   inputProductsDescription.setAttribute("name","offers_products[" + 
> numRow + "][products_description]");
>   inputProductsDescription.setAttribute("id","offers_products[" + 
> numRow + "][products_description]");  
>   inputProductsDescription.setAttribute("cols",25);
>   inputProductsDescription.setAttribute("rows",3); 
>  
>     HERE COMES THE TROUBLE MAKER:
>   inputProductsDescription.onfocus=function() { 
> products_price_return(numRow); }; 
>  
> ...
>  
> }
>  
> => NUMROW FINALLY IS 6
>  
> the for() and the rest of the script works well.
> now when i call the on focus function for let's say for the 2nd 
> created textarea
> the numRow value for the products_price_return() function
> always receives the nighest value of numRow from after the loop, in 
> this case 6,
> but not of the value it had when i created the element which should 
> have been 2 in the 2nd created textarea.
>  
> how can i achieve my goal,
> does anybody understand?
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>

-- 
Flavio Gomes
flavio at economisa.com.br




More information about the Javascript mailing list