<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表格过滤器</title>
<script language="javascript" src="../MyfirstjQueryFileWord/jquery-1.10.2.js">
</script>
<script language="javascript">
$(function(){
/*
//第一种方法
$('.a').css('background','#f00');
$('.b').css('background','#f0f');
$('.c').css('background','#00f');
$('.d').css('background','#ff0');
$('.e').css('background','#f0f');
*/
/*
//第二种方法
$('table tr:first').css('background-color','#f00');
$('table tr:last').css('background-color','#f00');
$('table tr:odd').css('background-color','#f00');
*/
$('table tr:even').css('background-color','#f00');
}); /* 当鼠标移到表格上是,当前一行背景变色 */
$(document).ready(function(){
$(".data_list tr td").mouseover(function(){
$(this).parent().find("td").css("background-color","#d5f4fe");
});
})
/* 当鼠标在表格上移动时,离开的那一行背景恢复 */
$(document).ready(function(){
$(".data_list tr td").mouseout(function(){
var bgc = $(this).parent().attr("bg");
$(this).parent().find("td").css("background-color",bgc);
});
}) </script>
</head>
<body>
<center>
<table width="500" border="1" height="500">
<tr>
<td class="a">&nbsp;</td>
</tr>
<tr>
<td class="b">&nbsp;</td>
</tr>
<tr>
<td class="c">&nbsp;</td>
</tr>
<tr>
<td class="d">&nbsp;</td>
</tr>
<tr>
<td class="e">&nbsp;</td>
</tr>
</table>
</center>
</body>
</html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表格过滤器</title>
<script language="javascript" src="http://files.cnblogs.com/files/caidupingblogs/jquery-1.10.2.js">
</script>
<script language="javascript">
$(function(){
/*
//第一种方法
$('.a').css('background','#f00');
$('.b').css('background','#f0f');
$('.c').css('background','#00f');
$('.d').css('background','#ff0');
$('.e').css('background','#f0f');
*/
/*
//第二种方法
$('table tr:first').css('background-color','#f00');
$('table tr:last').css('background-color','#f00');
$('table tr:odd').css('background-color','#f00');
*/
$('table tr:even').css('background-color','#f00');
});

/* 当鼠标移到表格上是,当前一行背景变色 */
$(document).ready(function(){
$(".data_list tr td").mouseover(function(){
$(this).parent().find("td").css("background-color","#d5f4fe");
});
})
/* 当鼠标在表格上移动时,离开的那一行背景恢复 */
$(document).ready(function(){
$(".data_list tr td").mouseout(function(){
var bgc = $(this).parent().attr("bg");
$(this).parent().find("td").css("background-color",bgc);
});
})

</script>
</head>
<body>
<center>
<table width="500" border="1" height="500">
<tr>
<td class="a"> </td>
</tr>
<tr>
<td class="b"> </td>
</tr>
<tr>
<td class="c"> </td>
</tr>
<tr>
<td class="d"> </td>
</tr>
<tr>
<td class="e"> </td>
</tr>
</table>
</center>
</body>

JavaScript之表格过滤器的更多相关文章

  1. JavaScript创建表格的两种方式

    方式一: var data = [ { id: 1, name: "first", age: 12 }, { id: 2, name: "second", ag ...

  2. Javascript合并表格相同内容单元格示例

    效果图: HTML代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http: ...

  3. JavaScript 实现表格隔行变色

    JavaScript 实现表格隔行变色 版权声明:未经授权,严禁分享! 构建界面 界面HTML代码 <style> #data,th,td{ border: 1px solid #aaaa ...

  4. javascript生成表格增删改查 JavaScript动态改变表格单元格内容 动态生成表格 JS获取表格任意单元格 javascript如何动态删除表格某一行

    jsp页面表格布局Html代码 <body onload="show()"> <center> <input type="text" ...

  5. day36—javascript对表格table的操作应用(一)

    转行学开发,代码100天——2018-04-21 今天记录一下,JavaScript对表格table的操作应用,包括表格元素的获取,创建,删除等. 一个普通的完整表格包括以下几个部分:table-&g ...

  6. 用JavaScript输出表格

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  7. Javascript输出表格

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. Javascript操作表格隔行变色

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  9. JavaScript之表格修改

    讲到表格,我们不免都了解它的属性及用途. colspan跨列(纵向的)和rowspan跨行(横向的). 表格中<tr></tr>标签标示行标签:<td></t ...

随机推荐

  1. Jquery 右键菜单(ContextMenu)插件使用记录

    目前做的项目需要在页面里面用右键菜单,在网上找到两种jquery的右键菜单插件,但是都有各种问题.所以就自己动手把两种插件结合了下. 修改后的右键菜单插架可以根据绑定的触发页面元素不同,复用同一个菜单 ...

  2. hdu 5592 ZYB's Game 树状数组

    ZYB's Game Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=55 ...

  3. Looksery Cup 2015 H. Degenerate Matrix 数学

    H. Degenerate Matrix Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/ ...

  4. linux下的文件操作——批量重命名

    概述:在日常工作中,我们经常需要对一批文件进行重命名操作,例如将所有的jpg文件改成bnp,将名字中的1改成one,等等.文本主要为你讲解如何实现这些操作 1.删除所有的 .bak 后缀: renam ...

  5. windows7添�windows2008R2域配置

    server端配置: windows2008R2 WIN+R -> dcmopro -> 下一步 -> .... client配置: windows7 配置 DNS,如图: 计算机 ...

  6. js 获取cookie

      <!DOCTYPE html>   <html xmlns="http://www.w3.org/1999/xhtml">       <head ...

  7. Perl的DATA文件句柄

    有太多次写完一个perl程序,需要另外新建一个文件来测试,每次觉得很繁琐,但又不得不这么做.没想到原来perl已经提供了解决方案,这就是DATA. 使用很简单,见下面这个例子: #!/usr/bin/ ...

  8. iOS-UISearchBar和UISearchController(参考网友来练习一下)

    #import "ViewController.h" #import "TestCell.h" @interface ViewController ()< ...

  9. 沈逸老师PHP魔鬼特训笔记(3)

    一.由于上两节课我们把程序放到了/usr/local/bin里面.每次编辑需要sudo .这节课我们使用PHPSTORM来编辑代码,专门把它拷贝出来,然后放到一个叫做home/godpro的文件夹下. ...

  10. 【Python千问 2】Python核心编程(第二版)-- 欢迎来到Python世界

    1.1 什么是Python 继承了传统编译语言的强大性和通用性,同时也借鉴了简单脚本和解释语言的易用性. 1.2 起源 来源于某个项目,那些程序员利用手边现有的工具辛苦工作着,他们设想并开发了更好的解 ...