I am trying to get values from a data set. My function has to loop from 1 to 7 to get my opening hours for 7 days. what i need to do is:
Where openHours[i] the "i" stands for a number between 1 and 7. I would like to attach that number on the word "openHours" in order to create a new word ex. "openHours1"
What would be the best way to do that? The "alert(i);" is working fine and is generating numbers from 1 to 7. I just need to attach those numbers on the string.
So far i tried everything that can comes in my head but I don't use javascript often so i am kind of stuck.
Thanks for the help.
function hoursFunction()
{
var i =0;
alert("Hello");
for(i=1;i<8;i++)
{
alert(i);
alert(hoursForm.openHours[i].value);
}
}
alert('hello' + 1)will give you 'hello1'.