I have a generic JavaScript function which takes one parameter
function foo(val) { ...}
and I want to call the function when submit a form
Give your inputs names it will make it easier
UPDATE:
If you give your button an id things can be even easier:
Javascript:
var button = document.getElementById("theButton"), value = button.form.valueId.value; button.onclick = function() { foo(value); }