Javascript problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
henk
Forum Newbie
Posts: 1
Joined: Fri Jun 27, 2003 7:39 am

Javascript problem

Post by henk »

Hello,


<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.2">
function voeruit(artnr) {
waarde = document.bestelformulier.aantal_+artnr.value;
alert(waarde);
}
</SCRIPT>




I want to use aantal_+artnr.value as a variable name.


But it don't work this way, who can help me?

Cheers,
Henk
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

something like this should work

Code: Select all

waarde = eval('document.bestelformulier.aantal_' + artnr + '.value');
Post Reply