to validate a simple registration form, however I initially tried to streamline this function by cycling through an array using a loop to point to various input elements in the HTML page itself. I found that when trying to use a variable in the aforementioned if statements the javascript failed to work i.e.

var test = "reguser";
if(regform.test.value = ""){
}

I know the javascript is looking for the input element "test" instead of "reguser" but is there any way I can force it to look for the contents of the variable.