WinHandle=window.open('',winName,features);
var form1 = WinHandle.document.createElement("form");
And I have something like this
WinHandle.form1.setAttribute("id",id);
WinHandle.form1.setAttribute("method","post");
WinHandle.form1.setAttribute("action",target);
当我执行此代码时,我会发现以下脚本错误:
Winhandle.form1 is null.
任何人都可以帮帮我吗?
答案 0 :(得分:0)
创建表单时,您已分配对变量form1
的引用。因此,要访问该引用,请继续使用声明的变量:
form1.setAttribute("id",id);
form1.setAttribute("method","post");
form1.setAttribute("action",target);