`
zhangyaochun
  • 浏览: 2596591 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

document.defaultView

阅读更多

document.defaultView

 

1、总结

 

  在浏览器里返回与document关联的window对象,如果没有有效的,就返回null

 

2、语法

 

 

var win = document.defaultView;

 

这个属性是只读的。

 

3、根据 quirksmode  defaultView 直到IE9才被支持。

 

 

 

扩展阅读:

 

1、https://developer.mozilla.org/en/DOM/document.defaultView

 

2、https://developer.mozilla.org/en/DOM/document

1
0
分享到:
评论

相关推荐

    获取css样式表内样式的js函数currentStyle(IE),defaultView(FF)

    接着检查浏览器是否为IE,使用`currentStyle`或`document.defaultView.getComputedStyle`方法来访问元素样式,最后通过字符串拼接的方式动态地获取特定的样式属性值。 这个函数的工作原理是基于对浏览器类型及其...

    javascript获取隐藏元素(display:none)的高度和宽度的方法

    obj.currentStyle[attribute]:document.defaultView.getComputedStyle(obj,false)[attribute];}但是如果这个元素是隐藏(display:none)的,尺寸又是未知自适应的,哪有上面的方法就不行了!因为display:none的元素是...

    javascriptDom节点API个人总结.docx

    - **`document.defaultView`** 返回包含该文档的窗口对象(通常为 `window`)。 - **`document.body`** 返回当前文档的 `<body>` 节点。 - **`document.head`** 返回当前文档的 `<head>` 节点。 - **`...

    js CSS操作方法集合

    //获取元素的真实的,最终的CSS样式属性值的函数 function ... }else if(document.defaultView && document.defaultView.getComputedStyle){ name = name.replace(/([A-Z])/g,”-$1″); name = name.toLowerCase

    Jquery作者John Resig自己封装的javascript 常用函数

    代码如下://获取元素的样式值。 function getStyle(elem... }else if(document.defaultView&&document.defaultView.getComputedStyle){ name=name.replace(/([A-Z])/g,”-$1″); name=name.toLowerCase(); var s=docume

    前端面试题目整理

    3. **document.defaultView**: 返回 document 对象所在的 window 对象。 4. **document.body**: 返回当前文档的 `<body>` 节点。 5. **document.head**: 返回当前文档的 `<head>` 节点。 6. **document....

    javascript 常用DomAPI总结

    - **document.defaultView**: 返回 document 对象所在的 window 对象。 - **document.body**: 返回当前文档的 `<body>` 节点。 - **document.head**: 返回当前文档的 `<head>` 节点。 - **document.activeElement**:...

    制作浮动广告

    t = parseInt(document.defaultView.getComputedStyle(tceng, null).top); c = parseInt(document.defaultView.getComputedStyle(cceng, null).top); } } ``` 通过判断当前浏览器是否支持`currentStyle`属性来...

    原生javascript获取元素样式属性值的方法

    而针对其他标准浏览器, W3C也提供了一个方法getPropertyValue, 此方法, 稍有点复杂, 首先要通过document.defaultView.getComputedStyle获得Css的样式对象, 然后通过该对象的getPropertyValue获取

    Javascript的IE和Firefox兼容性问题集合

    return document.defaultView.getComputedStyle(element, null).getPropertyValue(styleProp); } } ``` 4. **JSON支持**:IE7及以下版本不支持原生JSON对象,需要使用JSON.stringify和JSON.parse进行转换。可以...

    jQuery中使用了document和window哪些属性和方法小结

    `defaultView.getComputedStyle()`则返回元素的计算样式信息,是W3C标准方法,而IE中相应的属性是`currentStyle`。 10. **window.frameElement**:在`iframe`中,此属性返回当前文档所在的`iframe`元素,帮助我们...

    VB.net中应用IE打印的设置

    这可以通过设置`WebBrowser.Document.DefaultView.PrinterSettings`属性来完成。 6. **XMLData.xml**:文件名可能暗示了应用中涉及XML数据的处理。在VB.NET中,可以使用`XmlDocument`类来解析和操作XML数据。如果...

    js获取页面引用的css样式表中的属性值方法(推荐)

    else if (document.defaultView && document.defaultView.getComputedStyle) { var style = document.defaultView.getComputedStyle(node, null); return style.getPropertyValue(property); } ``` 最后,如果...

    JavaScript如何获取一个元素的样式信息

    } else if (document.defaultView && document.defaultView.getComputedStyle) { return document.defaultView.getComputedStyle(elem, "").getPropertyValue('font-size'); } ``` `getPropertyValue`方法接收一个...

    JS打开关闭移动层动画实例

    curVal = document.defaultView.getComputedStyle(obj, null)[stylename]; } return curVal; }; ``` 此函数用于获取元素的实际CSS样式值,兼容不同浏览器。 ##### 4. 获取最大宽度和高度 ```javascript menuOC....

    javascript获取隐藏元素(display-none)的高度和宽度的方法.docx

    obj.currentStyle[attribute] : document.defaultView.getComputedStyle(obj, false)[attribute]; } function getHiddenElementSize(element) { var originalDisplay = getDefaultStyle(element, 'display'); ...

    js滚动图片广告写法

    return element.currentStyle || document.defaultView.getComputedStyle(element, null); } ``` 4. **绑定函数上下文**:`Bind` 函数使得我们可以为某个对象绑定一个函数,并可以预设部分参数。 ```javascript...

Global site tag (gtag.js) - Google Analytics