如何在XCODE中使用JavaScript onclick事件处理程序-WebForm_DoPostBackWithOptions

时间:2013-06-13 15:49:24

标签: ios javascript-events

我正在编写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 但我不太了解。

知道如何以编程方式点击此按钮吗?

0 个答案:

没有答案