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> JS控制DIV显示与隐藏问题 急等,如何找出两个字符串的不同之处?急急急... 请问,如何改变网页上文本框中I型光标的颜色呢? Firefox如何在onchange后设置焦点不变 请问window.open打开窗口位置问题,能不能在屏幕中居中显示,感谢 求教动态生成下拉框内的元素的方法 有关初学者的问题,请各位高手指点!!!!!!!!!!!!!!!!!!!!! 怎样限制选中复选框的数量? 简单问题 Easy UI 等待界面如何做呀? 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>