1

我正在编写 iOS 应用程序来访问网站上的数据。它有用户名和密码。到目前为止,我无法以编程方式登录网站。下面是登录按钮的aspx代码

<div class="formRow formRowFull">
                    <label class="formLabel span4">
                        &nbsp;
                    </label>
                    <input type="submit" name="ctl00$ContentPlaceHolder1$btnSubmit" value="Log in" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$btnSubmit&quot;, &quot;&quot;, true, &quot;required&quot;, &quot;&quot;, false, false))" id="ContentPlaceHolder1_btnSubmit" class="mrg14 inputButton" />
                    &nbsp;&nbsp; <a data-fancybox-type="iframe" class="noteupload1" target="_parent" href="Forgot-Password.aspx" title="Forgot Password">
                        Forgot Password ?</a>
                </div>

我试过下面的代码

[self.webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('ContentPlaceHolder1_btnSubmit').submit();"];

[self.webView stringByEvaluatingJavaScriptFromString: @"WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$btnSubmit&quot;, &quot;&quot;, true, &quot;required&quot;, &quot;&quot;, false, false))"];

上面的代码用于使用 html。我猜 WebForm_DoPostBackWithOptions 是 .NET 框架方法。我在下面找到了与此 http://www.carlosag.net/articles/webparts/whidbey-faqhttp://plainoldstan.blogspot.in/2007/06/story-of-client-side-validation-in相关的链接.html 但我不太了解。

如何以编程方式单击此按钮?

4

0 回答 0