[英]How can I change table's individual cell with JavaScript
I have been trying to use JavaScript to display a table and I would like to change some cell's background color in some particular condition. 我一直在尝试使用JavaScript来显示表格,并且我想在某些特定条件下更改某些单元格的背景颜色。
Here is my code : 这是我的代码:
What I want is to change the color in middle column only like this 我想要的是仅更改中间列的颜色
However, It ends up like this 但是,它最终像这样
below is my HTML
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="wellness.js"></script>
<link rel="stylesheet" type="text/css" href="wellness.css"/>
</head>
<body>
<div class="table-title">
<h3>Wellness Report</h3>
<button class = "button search" type = "button" onclick="CreateTableFromJSON()" >Load Data</button>
</div>
<div id = "showData"></div>
</body>
</html>
Please tell me how to fix it. 请告诉我如何解决。 Thank you in advance
先感谢您
if (j === 1 && arrItems[1][col[i]] > 5 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.