的问题看起来是您使用的getElementById但输入的元素没有一个ID(他们只有一个名字)。
我还建议附加一个onSubmit事件到窗体并从按钮中删除onClick事件。
编辑:仔细查看代码后,我看到有一些其他问题可能会妨碍操作。最值得注意的是你不能嵌套窗体标签。还有一些其他的CSS和验证问题。
下面是一些工作代码:
测试页
function SubmitForm(el) {
// Get the form element so that we can set the action later
var form = document.getElementById('theForm');
// Set the action for the form based on which button was clicked
if (el.id == "A")
form.action = "a.php";
if (el.id == "B")
form.action = "b.php";
// You dont need to submit the form. It's alreasdy happening, so there is no need for an explicit call.
}