html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/java script" src="lib/jquery-1.5.2.js">
<script type="text/java script">
$(function() {
//pre元素下的所有子孙元素。
//$("form input")选 中[ , ]
/*
$("form input").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//pre元素下的子元素。
//[ ]
/*
$("form>input").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//pre元素后的next元素。pre 与next平级
//[ , ]
/*$("label+input").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//[ ]
//prev元素之后所有sibings元素
//siblings和next不同,siblings返回的是,所有同辈元素的集合。next,仅是一个。
/*
$("form ~ input").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//这就是next方式,选 中的只有一个。
$("form +input").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
});
http://www.w3.org/TR/html4/loose.dtd">
<script type="text/java script" src="lib/jquery-1.5.2.js">
<script type="text/java script">
$(function() {
//匹配找到的第一个元素
//[
/*
$("tr:first").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//匹配找到的最后一个元素
//[
/*
$("tr:last").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//能够 checked的input才有:checked
/*
$("input:not(:checked)").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
*/
//偶数元素,从0开始计数
/*
$("tr:even").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});*/
//奇数元素,从0开始计数。
/*
$("tr:odd").hover(function() {
$(this).addClas