不多说了直接看代码
安卓:
wView.post(new Runnable() { @Override public void run() { wView.loadUrl("javascript:fillContent()"); }});
网页:
<script language="javascript"> function fillContent(){ $('form').fadeIn(500); $('.wrapper').removeClass('form-success'); $("#userName").val("密码或账号有误"); $("#passWord").val(""); } </script>安卓不加线程可能会报错,错误内容如下:/WebView: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {4a77ef00} called on Looper (JavaBridge, tid 113) {4a7894dc}, FYI main Looper is Looper (main, tid 1) {4a77ef00})