I have 2 forms(form1,form2) on one page. I'm trying to re-use a function for both forms. The function is a simple if statement matching against one of the fields that both forms have.

right now I'm passing it like so... function('form1')

Code:
function(txt) {
var="document.forms."+txt+".field.value"
if(var=="ant1832"){...
I check what was passed to the variable using alert(var) and its "document.forms.form1.value."

How can I pass the actual value to the variable?