请教大家,我做一个自动填写表单并提交的工具,不知道为什么不能提交表单
请教大家一个问题 我用C#做个论坛自动发帖工具前面填写标题和内容都可以实现就是在按钮提交的时候不能实现了 不知道错在哪里了下面是代码 我写在WebBrowser的加载完成事件中
this.WebBrowser.Document.GetElementById("subject").InnerText = "adfdafasdfsadf";
this.WebBrowser.Document.GetElementById("e_textarea").InnerText = "ddddddddddddddddddddddddddd";
this.WebBrowser.Document.GetElementById("postform").InvokeMember("validate(form)");
表单的HTML代码
<form method="post" id="postform"
action="posthgdW.php?&action=newthread&fid=6&extra=&topicsubmit=yes"
enctype="multipart/form-data" onsubmit="return validate(this)">
按钮的HTML
<button type="submit" id="postsubmit" value="true" name="topicsubmit" tabindex="1">
发新话题
</button>
请教大家一个问题 我用C#做个论坛自动发帖工具前面填写标题和内容都可以实现就是在按钮提交的时候不能实现了 不知道错在哪里了下面是代码 我写在WebBrowser的加载完成事件中
this.WebBrowser.Document.GetElementById("subject").InnerText = "adfdafasdfsadf";
this.WebBrowser.Document.GetElementById("e_textarea").InnerText = "ddddddddddddddddddddddddddd";
this.WebBrowser.Document.GetElementById("postform").InvokeMember("validate(form)");
表单的HTML代码
<form method="post" id="postform"
action="posthgdW.php?&action=newthread&fid=6&extra=&topicsubmit=yes"
enctype="multipart/form-data" onsubmit="return validate(this)">
按钮的HTML
<button type="submit" id="postsubmit" value="true" name="topicsubmit" tabindex="1">
发新话题
</button>
this.WebBrowser.Document.postform.submit();
this.WebBrowser.Document.postform.submit();
win.execScript("temp()", "javascript");//调用函数
HtmlElement form = webBrowser1.Document.Forms["postform"];
form.InvokeMember("submit");