My form error javascript code
Some tips:


you'd probably better have a look at some jquery validation plugin that would do what you are looking for out of the box
to solve your "unknown parameters", you could probably use the jquery .serialize() function and loop through the array