JS控制显示隐藏兼容问题(IE6、IE7、IE8)
作者:bea
在IE7中, 使用jQuery 显示:$("#a").attr("style",""); 隐藏:$("#a").attr("style","display:none"); 但是显示这个方法在IE8中不行 IE8 显示:$("#a").removeAttr("style"); 隐藏:$("#a").attr("style","display:none"); IE6,最怪异,使用display:none不能隐藏select标签 下面这两个,经测试,在三个版本中都能正常使用 隐藏:
在IE7中,
使用jQuery
显示:$("#a").attr("style","");
隐藏:$("#a").attr("style","display:none");
但是显示这个方法在IE8中不行
IE8
显示:$("#a").removeAttr("style");
隐藏:$("#a").attr("style","display:none");
IE6,最怪异,使用display:none不能隐藏select标签
下面这两个,经测试,在三个版本中都能正常使用
隐藏:document.getElementById("a").style.display="none";
显示:document.getElementById("a").style.display="";
有用 |
无用
使用jQuery
显示:$("#a").attr("style","");
隐藏:$("#a").attr("style","display:none");
但是显示这个方法在IE8中不行
IE8
显示:$("#a").removeAttr("style");
隐藏:$("#a").attr("style","display:none");
IE6,最怪异,使用display:none不能隐藏select标签
下面这两个,经测试,在三个版本中都能正常使用
隐藏:document.getElementById("a").style.display="none";
显示:document.getElementById("a").style.display="";
猜你喜欢
您可能感兴趣的文章:
- JQuery 选项卡效果(JS与HTML的分离)
- JQuery Tab选项卡效果代码改进版
- JQuery autocomplete 使用手册
- JavaScript 弹出窗体点击按钮返回选择数据的实现
- js 实现打印网页中定义的部分内容的代码
- js prototype截取字符串函数
- javascript getElementsByClassName函数
- JS getStyle获取最终样式函数代码
- Javascript 通过json自动生成Dom的代码
- JS中confirm,alert,prompt函数使用区别分析
- JavaScript中实现块作用域的方法
- cloudgamer出品ImageZoom 图片放大效果
- js 异步处理进度条
- JavaScript中String和StringBuffer的速度之争
- Cookie 小记
- javascript操作cookie的文章(设置,删除cookies)
- 在模板页面的js使用办法
- JavaScript中apply与call的用法意义及区别说明
- 使用Microsoft Ajax Minifier减小JavaScript文件大小的方法