从webView获取列文本

时间:2016-03-29 17:49:58

标签: javascript android html webview

如何从webView获取列文本。我将html页面的内容分成了以下列:

 public void injectJavascript() {
    String js = "javascript:function initialize() { " +
            "var d = document.getElementsByTagName('body')[0];" +
            "var ourH = window.innerHeight; " +
            "var ourW = window.innerWidth; " +
            "var fullH = d.offsetHeight; " +
            "var pageCount = Math.floor(fullH/ourH) + 1;" +
            "var currentPage = 0; " +
            "var newW = pageCount*ourW; " +
            "d.style.height = ourH+'px';" +
            "d.style.width = newW+'px';" +
            "d.style.webkitColumnGap = '2px'; " +
            "d.style.margin = 0;" +
            "d.style.webkitColumnCount = pageCount;" +
            "}";
    loadUrl(js);
    loadUrl("javascript:initialize()");
}

现在我想获得混凝土列的内容(例如 - 6)。我尝试在WebChromeClient中调用 onJsAlert()方法。我必须在下一个6页文本的方法中调用什么?

  loadUrl("javascript:alert(????)");

0 个答案:

没有答案