Fire my passion

Anything with my most passion……
JQuery学习笔记(五)
六、实用函数

1、JQuery的标记
$.browser
<b>msie</b>—Set to true if the user agent header identifies the browser as Microsoft

Internet
Explorer.
mozilla—Set to true if the user agent header identifies the browser as any Mozillabased
browser. This includes browsers such as Firefox, Camino, and Netscape.
safari—Set to true if the user agent header identifies the browser as Safari or any
Safari-based browser such as OmniWeb.
opera—Set to true if the user agent header identifies the browser as Opera.
version—Set to the version number of the rendering engine for the browser.

version并不是浏览器的版本号,而是浏览器核心的版本号

用这个标记,主要适用于在不同浏览器的方法相同,但是参数类型,或参数个数不同的情况

$.boxModel

结果返回true代表是W3C兼容的盒子模型,反之为IE的模型
主要可以体现在strict mode和quirks mode的差异
关于IE quirks mode的一个经典再现
元素的width指的是“内容的width” + padding的width + border的width,而W3C模式中,指明

元素的width应该仅仅是“内容的width”

可以在网页开头声明DOCTYPE来显示设置成strict mode

$.styleFloat

这个标记主要是为了兼容IE和其他浏览器对style中的float的差异进行处理的
在IE中,style的float应为 styleFloat,在其他浏览器中为 cssFloat
例如
element.style[$.styleFloat] = 'left';

posted on 2008-02-25 16:46  everx  阅读(276)  评论(0编辑  收藏  举报