simonchristieis
Programmer
I have an object
function a(b,c,d){
a.name=b
a.age=c
a.dob=d
}
Billy = new a("Billy",26,"23/05/1977"
no problems so far
now i want to create a loop that will access whichever properties i need using this array
propArray = new Array("name","age","dob"
function write(){
name = "Billy"
i=1;
while i < 3 {
temp = "formfield"+i
// this is where the problem lies
temp = eval(name.propArray)
// i cannot get this eval function call to work
}
}
any ideas i would be very grateful
please excuse the sloppy code - this is not the actual code - just made it up to clarify things
function a(b,c,d){
a.name=b
a.age=c
a.dob=d
}
Billy = new a("Billy",26,"23/05/1977"
no problems so far
now i want to create a loop that will access whichever properties i need using this array
propArray = new Array("name","age","dob"
function write(){
name = "Billy"
i=1;
while i < 3 {
temp = "formfield"+i
// this is where the problem lies
temp = eval(name.propArray)
// i cannot get this eval function call to work
}
}
any ideas i would be very grateful
please excuse the sloppy code - this is not the actual code - just made it up to clarify things