运用jquery实现table单双行不同显示并能单行选中
作者:bea
代码如下: $(document).ready(function(){ $("p:odd").css("background-color", "#bbf"); $("p:even").css("background-color","#ffc"); $("p").click(function () { $("p").each(function(){ if($(this).hasClass("highlight")){ $(this).removeClass("h
代码如下:
$(document).ready(function(){
$("p:odd").css("background-color", "#bbf");
$("p:even").css("background-color","#ffc");
$("p").click(function () {
$("p").each(function(){
if($(this).hasClass("highlight")){
$(this).removeClass("highlight");
}});
$(this).addClass("highlight");
});
});
源码参考gamil:test_jquery_table
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- jquery tools之tabs 选项卡/页签
- jquery JSON的解析方式
- jqPlot Option配置对象详解
- jqPlot jquery的页面图表绘制工具
- IE DOM实现存在的部分问题及解决方法
- 从父页面读取和操作iframe中内容方法
- javaScript 数值型和字符串型之间的转换
- JavaScript中null与undefined分析
- js 字符串操作函数
- javaScript Array(数组)相关方法简述
- 对象特征检测法判断浏览器对javascript对象的支持
- javascript 一个函数对同一元素的多个事件响应
- IE中radio 或checkbox的checked属性初始状态下不能选中显示问题
- javascript 解析后的xml对象的读取方法细解
- jquery 将disabled的元素置为enabled的三种方法
- javaScript 判断字符串是否为数字的简单方法
- 利用javascript/jquery对上传文件格式过滤的方法
- javascript 动态table添加colspan owspan 参数的方法
- jquery 表单下所有元素的隐藏