Forms JSP javascript函数单击不同的JSP页面

Forms JSP javascript函数单击不同的JSP页面,forms,jsp,javascript,Forms,Jsp,Javascript,我有一个表单和javascript函数来打开2.jsp页面,但它一直给我 Message: Object doesn't support this property or method 我是这样做的。我试着只放重要的部分 <form name = iForm action=1.jsp method=POST> <input type="button" value="Button2" name=button2 onclick="OnButton1()"/> <

我有一个表单和javascript函数来打开2.jsp页面,但它一直给我

Message: Object doesn't support this property or method
我是这样做的。我试着只放重要的部分

<form name = iForm action=1.jsp method=POST>
    <input type="button" value="Button2" name=button2 onclick="OnButton1()"/>
</form>

<script language="JavaScript">
    function OnButton1{
        document.iFrom.action = "2.jsp";
        document.iFrom.target = "_blank";
        document.iFrom.submit();
        return true;
}
< /script>

函数OnButton1{
document.iFrom.action=“2.jsp”;
document.iFrom.target=“_blank”;
document.iFrom.submit();
返回true;
}


我知道一种通过“窗口”打开的方法,但我想知道是否有这种方法

您没有在JavaScript函数名后加括号,并且在脚本中拼写错了表单名

纠正这些错误,它应该像你所期望的那样工作


同样,target属性也适用于表单。

target适用于锚元素,而不是表单元素。使用链接而不是表单,它应该适合您。