兼容的话题:inline和block

2.兼容的话题:inline和block

例 2.2

<HTML>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</HEAD>
<script language="JavaScript">
 function swiDisplay(meO){
/*马克-to-win: 火狐和IE8中me.style.display开始时是没有值的,因为style="color:red;position:relative;" 如果是style="color:red;position:relative;display:inline",就有值了。但一旦赋值后, 就会一直有值了*/
     meTry=document.getElementById('redText');
     alert("meTry===me is"+(meTry===meO));
     alert("arguments[0].id is"+ arguments[0].id);
/*为什么redText可以直接用,因为是id域*/
     alert("me===redText is"+(meO===redText));
     alert("me.style.display is"+meO.style.display );
     if (window.navigator.userAgent.indexOf("MSIE") >= 1)
     {
          alert("ie");
          alert("me.currentStyle.display is"+ meO.currentStyle.display);
          meO.style.display=meO.currentStyle.display;
     }
/*可以单步调试在firebug里看看window.navigator.userAgent*/
     else if (window.navigator.userAgent.indexOf("Firefox") >= 1)
     {
          alert("firefox");
          alert("window.getComputedStyle(me1).getPropertyValue('display') is"+ window.getComputedStyle(meO).getPropertyValue('display'));
          meO.style.display=window.getComputedStyle(meO).getPropertyValue('display');
     }
     if (meO.style.display=="block"){
/*注意下面的语句,可以变成style.display="",就是说inline
和“”效果是一样的, 这只是在set时,get时getComputedStyle
会返回inline*/
        meO.style.display="inline";
        alert("文本现在是:'inline'.");
     }
     else {
        if (meO.style.display=="inline"){
            meO.style.display="block";
            alert("文本现在是:'block'.");
        }
    }
  }
</script>

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_43650923/article/details/102806673

posted @   malala  阅读(22)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示