2015-04-26 53 views
2

我試圖刪除這個div刪除類:如何從web視圖

<div data-role="navbar" data-iconpos="bottom" class="ui-navbar" role="navigation"> 
    <ul class="ui-grid-b"> 
     <li class="ui-block-a"> 
      <a href="http://www.siverekhaber.net/mobil/galeriler.html" data-icon="camera" 
       class="ui-link ui-btn ui-icon-camera ui-btn-icon-bottom">Galeri</a> 
     </li> 
     <li class="ui-block-b"> 
      <a href="http://www.siverekhaber.net/mobil/videolar.html" data-icon="video" 
       class="ui-link ui-btn ui-icon-video ui-btn-icon-bottom">Video</a> 
     </li> 
     <li class="ui-block-c"> 
      <a href="http://www.siverekhaber.net/mobil/yazarlar.html" data-icon="edit" 
       class="ui-link ui-btn ui-icon-edit ui-btn-icon-bottom">Yazarlar</a> 
     </li> 
    </ul> 
</div> 

我試圖重寫onPageFinished方法:

@Override 
    public void onPageFinished(WebView view, String url) { 
     view.setVisibility(View.VISIBLE); 
     final Animation fade = new AlphaAnimation(0.0f, 1.0f); 
     fade.setDuration(200); 
     view.startAnimation(fade); 
     view.setVisibility(View.VISIBLE); 
     mRefreshPbar.setVisibility(View.INVISIBLE); 
     mRefreshBtn.setVisibility(View.VISIBLE); 
     updateActionView(); 
     mWebview.loadUrl("javascript:(function() { " + 
      "if (typeof(document.getElementsByClassName('ui-footer')[0]) != 'undefined' && document.getElementsByClassName('ui-footer')[0] != null){"+ 
      "document.getElementsByClassName('ui-footer')[0].style.display = 'none';"+ 
      "})()"); 
    } 

,但它不工作。問題是什麼?

回答

2

您需要撥打void 0以防止瀏覽器重定向到純文本文件。

mWebview.loadUrl("javascript:if (typeof(document.getElementsByClassName('ui-footer')[0]) != 'undefined' && document.getElementsByClassName('ui-footer')[0] != null){document.getElementsByClassName('ui-footer')[0].style.display = 'none';} void 0"); 
+0

感謝您的意見。但它仍然不起作用。你可以檢查網站嗎?它是www.siverekhaber.net/mobil當我手動刪除ui-navbar div它消失了,但JavaScript無法正常工作。 – Dauezevy

+0

您的JavaScript錯誤。讓我解決它... – jyoon

+0

好的。我在等你的答案。 – Dauezevy