Welcome

首页 / 脚本样式 / jQuery / jQuery入门[1]-构造函数

jQuery入门[1]-构造函数2011-11-01 cnblogs thinhunan Lyn体积小(v1.2.315kb)

丰富的DOM选择器(CSS1-3+XPath) 跨浏览器(IE6,FF,Safari,Opera)

链式代码

强大的事件、样式支持

强大的AJAX功能

易于扩展,插件丰富

jQuery的构造函数接收四种类型的参数:

jQuery(expression,context)

jQuery(html)

jQuery(elements)

jQuery(fn)

第一种根据表达式(ID,DOM元素名,CSS表达式,XPath表达式)找出文档中的元素,并组装成一个 jQuery对象返回。

DEMO:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>jQuery basic</title><style type="text/css">.selected {background-color:Yellow;}</style><script src="../scripts/jquery-1.2.3.intellisense.js" type="text/javascript"></script></head><body><h3>jQuery构造函数</h3><ul><li>jQuery(expression,context)</li><li>jQuery(html)</li><li>jQuery(elements)</li><li>jQuery(fn)</li></ul><script type="text/javascript"></script></body></html>