<html>
<body>
<table id='customers'>
<th>Router</th><th>Hong Kong</th><th>Singapore</th><th>East (Newark)</th><th>Central (Denver)</th><th>West coast (LA)</th><th>Montreal</th><th>Paris</th><th>AMS</th><th>London</th><tr><th>Hong Kong</th><td>N/A</td><td>34.95</td><td>222.34</td><td>175.97</td><td>147.18</td><td>234.99</td><td>260.47</td><td>250.88</td><td>277.79</td></tr>
<tr><th>Singapore</th><td>35.01</td><td>N/A</td><td>244.28</td><td>197.94</td><td>185.47</td><td>250.01</td><td>158.67</td><td>168.75</td><td>251.44</td></tr>
<tr><th>East (Newark)</th><td>225.09</td><td>235.61</td><td>N/A</td><td>40.49</td><td>73.11</td><td>9.11</td><td>78.74</td><td>75.46</td><td>69.98</td></tr>
<tr><th>Central (Denver)</th><td>184.44</td><td>203.51</td><td>46.41</td><td>N/A</td><td>41.78</td><td>42.55</td><td>115.15</td><td>127.17</td><td>110.58</td></tr>
<tr><th>West coast (LA)</th><td>162.93</td><td>171.4</td><td>71.61</td><td>37.85</td><td>N/A</td><td>88.81</td><td>149.18</td><td>147.34</td><td>140.41</td></tr>
<tr><th>Montreal</th><td>227.71</td><td>253.18</td><td>9.11</td><td>42.67</td><td>88.69</td><td>N/A</td><td>85.89</td><td>84.59</td><td>79.01</td></tr>
<tr><th>Paris</th><td>233.03</td><td>161.62</td><td>78.44</td><td>112.98</td><td>149.44</td><td>86.06</td><td>N/A</td><td>11.11</td><td>9.05</td></tr>
<tr><th>AMS</th><td>254.16</td><td>164.82</td><td>77.27</td><td>118.53</td><td>147.23</td><td>83.41</td><td>11.22</td><td>N/A</td><td>6.09</td></tr>
<tr><th>London</th><td>251.09</td><td>167.94</td><td>70.58</td><td>121.16</td><td>141.18</td><td>79.27</td><td>9.81</td><td>6.07</td><td>N/A</td></tr>
</table>
</body>
</html>
桌子的颜色必须根据条件而变化 根据值,其颜色必须从绿色黄色或红色更改
答案 0 :(得分:0)
通过jquery这样尝试:
$(document).ready(function () {
$('#filltable tr td').each(function (i) {
var k = $('#filltable tr td:eq(' + i + ')').text() == 'N/A' ? '0' : $('#filltable tr td:eq(' + i + ')').text();
if (parseFloat(k) > 0 && parseFloat(k) < 100) {
$('#filltable tr td:eq(' + i + ')').css({ 'color': 'red' });
}
})
})