If the form and the code function codename are in the same page or frame, it will not throw an error.
If the form and the code, function codename are in the different frames, some changes need to make:
in the form
onClick="...;parent.frameFunction.codename();..."
in the code, function codename...