我正在编写iOS应用程序来访问网站上的数据。它有用户名和密码。到目前为止,我无法以编程方式登录网站。下面是登录按钮的aspx代码
<div class="formRow formRowFull">
<label class="formLabel span4">
</label>
<input type="submit" name="ctl00$ContentPlaceHolder1$btnSubmit" value="Log in" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$btnSubmit", "", true, "required", "", false, false))" id="ContentPlaceHolder1_btnSubmit" class="mrg14 inputButton" />
<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("ctl00$ContentPlaceHolder1$btnSubmit", "", true, "required", "", false, false))"];
以上用于处理html的代码。我猜WebForm_DoPostBackWithOptions是.NET框架方法。我在下面找到了与此相关的链接 http://www.carlosag.net/articles/webparts/whidbey-faq 和 http://plainoldstan.blogspot.in/2007/06/story-of-client-side-validation-in.html 但我不太了解。
知道如何以编程方式点击此按钮吗?