table 当前行,与下一行的值一样就不变色,反之就变色 隔行变色以条件变色 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 类似如下<!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 src="http://code.jquery.com/jquery-1.11.1.min.js"></script><script>$(function(){ $('table tr').each(function(index, element) { switch($(this).find('td:first').html()) { case 'a': $(this).css('backgroundColor','red'); break; case 'b': $(this).css('backgroundColor','blue'); break; case 'c': $(this).css('backgroundColor','yellow'); break; } });})</script></head><body><table> <tr><td>a</td><td>1</td></tr> <tr><td>a</td><td>1</td></tr> <tr><td>b</td><td>1</td></tr> <tr><td>c</td><td>1</td></tr> <tr><td>d</td><td>1</td></tr> <tr><td>d</td><td>1</td></tr></table></body></html> 求定时刷新 还是定位select选项的问题 EXT的TextField中的正则表达式 指定日期的时区 获取农历日期 关于在Safari中向xsl传递dom的一个问题 求个JS。。。急!!!!!!! 用js生成html元素? 关于动态添加下拉列表选项的问题! 当我输入正确的时候输入框后面的文字变绿色 错误的时候变红色怎么处理呢 ajax 请求响应头信息 一个chrome extension开发的疑问
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
$(function(){
$('table tr').each(function(index, element) {
switch($(this).find('td:first').html())
{
case 'a':
$(this).css('backgroundColor','red');
break;
case 'b':
$(this).css('backgroundColor','blue');
break;
case 'c':
$(this).css('backgroundColor','yellow');
break;
}
});
})
</script>
</head><body>
<table>
<tr><td>a</td><td>1</td></tr>
<tr><td>a</td><td>1</td></tr>
<tr><td>b</td><td>1</td></tr>
<tr><td>c</td><td>1</td></tr>
<tr><td>d</td><td>1</td></tr>
<tr><td>d</td><td>1</td></tr>
</table>
</body>
</html>