( ! ) Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in D:\www\up\jQuery\jquery_07.php on line 20
Call Stack
#TimeMemoryFunctionLocation
10.0156355992{main}( )...\jquery_07.php:0

( ! ) Warning: include(http://pub.houheaven.com/Nav02/Nav_deep2.htm): failed to open stream: no suitable wrapper could be found in D:\www\up\jQuery\jquery_07.php on line 20
Call Stack
#TimeMemoryFunctionLocation
10.0156355992{main}( )...\jquery_07.php:0

( ! ) Warning: include(): Failed opening 'http://pub.houheaven.com/Nav02/Nav_deep2.htm' for inclusion (include_path='.;C:\php\pear') in D:\www\up\jQuery\jquery_07.php on line 20
Call Stack
#TimeMemoryFunctionLocation
10.0156355992{main}( )...\jquery_07.php:0

为元素添加class

$(content).addClass(class)

如果预先在css文件中设定好了样式,就可以通过添加类来改变元素样式。

如果想要添加两个样式,需要用空格进行分隔,如:$(content).addClass("Class01 Class02")


删除元素的class

删除一个:$(content).removeClass(class)

删除多个:$(content).removeClass("Class01 Class02")


判断元素是否含有指定的class

var strbool=$(selector).hasClass(class);

返回值:布尔类型。


动态增删元素class

$(content).toggleClass(class)

$(content).toggleClass(class,switch)

如果元素忠含有class属性,则删除;否则添加。表达式switch为真,则追加,为假,则删除。

var count=1;

$("p#one").click(function(){$(this).toggleClass("Red");});

$("p#two").click(function(){$(this).toggleClass("Red",count++%3==0);});

获取元素的style属性值

$(content).css(name);

$(content).css(properties);

$(content).css(key,value);

属性说明
name获取属性值:指定属性名来获取其属性值
properties设定属性值:书写方式为{属性名:"值",属性名:"值"…},可以设置多个属性
key,value设置属性值:key为属性名,value为属性值,两者都必须用双引号火单引号括起来
显示框架
显示框架
显示框架
显示框架