我想 td id =“IOMToolbarActive1_kaydet_b”自动点击
<tr>
<td><img src="../../images/toolimages/seperator.jpg" border="0"></td>
<td id="IOMToolbarActive1_kaydet_b" width="25">
<img src="../../images/toolimages/save.jpg" style="cursor:hand;CURSOR:pointer;" alt="Kaydet" onmouseover="this.src='../../images/toolimages/save_a.jpg'" onmouseout="this.src='../../images/toolimages/save.jpg'" onclick="return AlanKontrolveKayit();" border="0">
</td>
</tr>
答案 0 :(得分:0)
如果要自动单击img
标签
mWebView = (WebView) findViewById(R.id.web_view);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
mWebView.addJavascriptInterface(new WebAppInterface(this), "Android");
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
mWebView.loadUrl( "javascript:window.onload= (function(){ document.getElementById('IOMToolbarActive1_kaydet_b').getElementsByTagName('img')[0].click();})();");
}
});
// ...
如果要自动单击id="IOMToolbarActive1_kaydet_b"
标签,请替换
mWebView.loadUrl( "javascript:window.onload= (function(){ document.getElementById('IOMToolbarActive1_kaydet_b').getElementsByTagName('img')[0].click();})();");
使用
mWebView.loadUrl( "javascript:window.onload= (function(){ document.getElementById('IOMToolbarActive1_kaydet_b').click();})();");