private void initWebView(String url) {
twoCode.loadUrl(url);
WebSettings settings = twoCode.getSettings();
settings.setJavaScriptEnabled(true);// 设置支持javascript脚本 twoCode.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
} @Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
String fun = "javascript:function getClass(parent,mClass)" +
"{" +
"var aEle=parent.getElementsByTagName('div');" +
"var aResult=[];" +
"var i=0;" +
"for(i<0; i<aEle.length; i++) {" +
"if(aEle[i].className==mClass)" +
"{" +
"aResult.push(aEle[i]);" +
"}" +
"};" +
"return aResult;" +
"}";
view.loadUrl(fun); String fun2 = "javascript:function hideOther() " +
"{" +
"getClass(document,'horizontal-padding')[0].style.display='none';" +// 摇一摇或点击二维码刷新
"getClass(document,'text-right horizontal-padding vertical-margin')[0].style.display='none';" +// 如何开门?获取帮助
"document.getElementById('header').style.display='none';" +// 锁掌柜体验群
"document.getElementById('footer').style.display='none';" +// Copyright ©2014-2016. uclbrt, inc. All Right Reserved.
"document.getElementById('roomInfo').style.display='none';" +// 测试楼栋 一层 103
"}";
view.loadUrl(fun2);
view.loadUrl("javascript:hideOther();");
}
}); }
 js代码

 1 function getClass(parent,mClass)
{
var aEle=parent.getElementsByTagName('div');
var aResult=[];
var i=0;
for(i<0;i<aEle.length;i++)
{
if(aEle[i].className==mClass)
{
aResult.push(aEle[i]);
}
};
return aResult;
} function hideOther()
{
getClass(document,'horizontal-padding')[0].style.display='none';
getClass(document,'text-right horizontal-padding vertical-margin')[0].style.display='none';
getClass(document,'advertisementContainer')[0].style.display='none';
getClass(document,'copyright')[0].style.display='none';
document.getElementById('header').style.display='none';
document.getElementById('footer').style.display='none';
document.getElementById('roomInfo').style.display='none';
document.getElementById('actionListContainer').style.display='none';
getClass(document,'modal-body')[0].style.display='none';
getClass(document,'modal fade')[0].style.display='none';
}

隐藏weibview里面的部分h5的更多相关文章

  1. 锋利的jQuery之事件

    jQuery中的事件和动画 JavaScript和HTML之间的交互是通过用户和浏览器操作页面时引发的事件来处理的.当文档或者它的某些元素发生某些变化或操作时,浏览器会自动生成一个事件.例如:当浏览器 ...

  2. javascript触发input-file的click事件

    概述 input:file本身自带的样式不太好看,但是又没法设置样式. 由于系统限制,不能通过代码触发,只允许用户自主点击. 通常的解决办法是,把input:file透明化,实际上点击的还是input ...

  3. textarea

    ■ 摘要 项目 说明 形式 <textarea>-</textarea> 支持 H2+ / e2+ / N2+ / Fx1+ / Op6+ / Ch1+ / Sa1+ 标签省略 ...

  4. jquery 学习笔记 (2)--write less,do more

    $(window).load(function(){      })           window.onload=function(){ } toggle()方法 toggle()方法的语法结构: ...

  5. uni-app使用腾讯地图注意点

    地图map组件使用腾讯地图自定义样式: 1:在使用地图map组件腾讯地图时,获取本地定位,经纬度转地址与地址转经纬度解析时,小程序可以直接使用.但是h5版本会报跨域问题,目前前端没有找到更好的解决方法 ...

  6. h5 ios手机 隐藏input输入光标

    前面在做一个H5中用到的6位数字密码弹框(类似支付.微信那种)时,遇到一个可怕问题,那就是在浏览器和安卓中是不显示输入光标的,但是在ios手机上光标总是能看见,像穿透一样地显示最外层. 先说下实现密码 ...

  7. 超出隐藏兼容H5

    常用的字体超出隐藏不能兼容H5和ios 所以整理了两种用jquery来实现的方法,然后弊端是只能隐藏指定字数不能段落隐藏 方法一. //超出隐藏兼容iosfunction hide(text,nube ...

  8. h5的video下载按钮如何隐藏

    h5的video下载按钮在部分手机系统上是不可用的,想要把这个按钮屏蔽掉,可苦于没有像屏蔽全屏按钮那样的伪类video::-webkit-media-controls-fullscreen-butto ...

  9. 微信小程序H5预览页面框架(二维码不隐藏)

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

随机推荐

  1. JS定时程序,设定一个一直刷新,又时间间隔的js,读取当前的时间并显示

    <!doctype html><html><head><meta charset="utf-8"><title>无标题文 ...

  2. ulimit

    .修改ulimit vim /etc/security/limits.conf * soft nproc * hard nproc * soft nofile * hard nofile vim /e ...

  3. JAVA类图

    类与类图 类(Class)封装了数据和行为,是面向对象的重要组成部分,它是具有相同属性.操作.关系的对象集合的总称. 在系统中,每个类具有一定的职责,职责指的是类所担任的任务,即类要完成什么样的功能, ...

  4. IOS学习之路--OC的基础知识

    1.项目经验 2.基础问题 3.指南认识 4.解决思路 ios开发三大块: 1.Oc基础 2.CocoaTouch框架 3.Xcode使用 -------------------- CocoaTouc ...

  5. sqllite

    public static void tt()        {            int ID = 0; while(true)            {                stri ...

  6. loadrunner ---模拟多IP登录

    1.打开HP LoadRunner ->Tools ->IP Wizard

  7. eclipse maven插件问题:error occurred while automatically activating bundle org.eclipse.m2e.core.ui (525)

    ①所有应用Close Project ②重启eclipse  ③所有应用Open Project 出自:http://blog.csdn.net/qr719169236/article/details ...

  8. 调用SAP函数创建寄售退货订单的时候报错:业务对象 BUS2032 是销售订单,销售凭证类别 H 是退货。

    RE.KR订单类型用BAPI_CUSTOMERRETURN_CREATE 其他用BAPI_SALESORDER_CREATEFROMDAT2

  9. InnoDB is limited to row-logging when transaction isolation level is READ COMMIT

    分析: http://blog.csdn.net/lingli219/article/details/46372737 解决办法: http://niuzhenxin.iteye.com/blog/1 ...

  10. Setup Factory 关闭正在运行的程序

    --在全局函数中增加 适用用Setup Factory 9 function FindAndCloseProcessByName(strName)  local tblProcesses = Wind ...