...

View Full Version : simple .value function need help asap



simbawoomba
01-04-2007, 04:55 PM
hi i have got the following function

it takes 3 strings, what is being copied where it is going and a number which must be placed on the end of what is being copied


function swapvalues(from, num,to){
var a=from+num;
to.value=a;
to.value=a.value';
}

what it should do:

basically add from and num together

so the inputs will be like this from = "Template" num = "0" ect..

i want it to add the from and num together to make Template0

then get the swap the value of the destination with template0

so to.value=Template0.value

although this does not seem to work with the a.value thing please help!!

A1ien51
01-04-2007, 07:36 PM
You are creating a string here: var a=from+num;

that is not an object reference

You need to do something like

document.forms[0].elements[from+num].value

Eric

simbawoomba
01-05-2007, 10:07 AM
thanks man, i have fixed the problem now with your help! it had been bugging me for a while:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum