我有一个带有多个按钮的 UIWebView 页面。需要识别点击的是哪个按钮UIWebView.
UIWebview 加载内容的页面源:
<form action="settings_personal.php" data-ajax="false" method="post">
<input type="submit" name ="btn_settings_personal" value=" Goals (Personal data) " data-icon="star" data-theme="g" />
</form>
<form action="settings_global.php" data-ajax="false" method="post">
<input type="submit" name ="btn_settings_global" value=" Settings " data-icon="gear" data-theme="g" />
</form>
<form action="" data-ajax="false" method="post">
<input type="submit" name ="btn_web_access" value=" Web Plattform Access " data-icon="plus" data-theme="h" />
</form>
我需要识别为“btn_web_access”命名按钮单击的按钮???
我已经实现了以下:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType{
NSString* clicked = [self.webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('btn_web_access').click();"];
NSLog(@"CLICK %@",clicked);
}
但它没有用..提前谢谢。