PDA

View Full Version : Array



marcoue
04-30-2007, 02:19 PM
Hello!

A quick one this morning!

I have many textfields that contain prices.

I need to convert them to US currency when a button is clicked...

A made an array of my feilds:


var itemPrice = new Array();
itemPrice[0] = a0_prix_txt;
itemPrice[1] = a1_prix_txt;My function:


function us() {
itemPrice[0].text = (itemPrice[0].text)*0.897737;
itemPrice[1].text = (itemPrice[1].text)*0.897737;
}
Obviously, I have undreds of items... Is there a way I could build a function that would be applied to all the items in my array at the same time without having to write every item as a line in my function?

Exemple


function us() {
itemPrice[ALL ITEMS].text = (itemPrice[0].text)*0.897737;
}Thanks in advance!

Marc
Montréal, CANADA