I have skimmed down my code to make it easier to read but this is basically what I have and it is working fine.
function findmatch() {
var value = document.search1.search_text1.value;
}
But what I want to do is have a parameter x and replace the 1’s with the x but I can’t seem to do it. I thought the following would work but had no luck with it.
function findmatch(x) {
var value = document.'search'+x.'search_text'+x.value;
}
Any suggestions would be greatly appreciated.
Thanks.
You need to use square bracket notation:
To explain a little further, in JS
is the same thing as
thus, with the latter you can dynamically build names