开发者

post a form inside a javascript

开发者 https://www.devze.com 2023-03-03 07:36 出处:网络
WinHandle=window.open(\'\',winName,features); var form1 = WinHandle.document.createElement(\"form\"); And I have something like this
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);
0

精彩评论

暂无评论...
验证码 换一张
取 消