post a form inside a javascript
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);
When I execute thi开发者_开发技巧s code I m geting the below script error:
Winhandle.form1 is null.
can any one please help me?
When you created the form, you assigned the reference to the variable form1
. So, to access that reference, continue to use the variable as declared:
form1.setAttribute("id",id);
form1.setAttribute("method","post");
form1.setAttribute("action",target);
精彩评论