首页 > 代码库 > 表格隔行变色-js代码

表格隔行变色-js代码

<!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 type="text/javascript" src="jquery-1.11.0.js"></script><script type="text/javascript">    $(document).ready(function(){        $("table tr:odd").css("background","red");    });</script></head><body><table border="1" width="500">    <tr>        <td>11</td>        <td>12</td>        <td>13</td>        <td>14</td>    </tr>    <tr>        <td>21</td>        <td>22</td>        <td>23</td>        <td>24</td>    </tr>    <tr>        <td>31</td>        <td>32</td>        <td>33</td>        <td>34</td>    </tr>    <tr>        <td>41</td>        <td>42</td>        <td>43</td>        <td>44</td>    </tr>    <tr>        <td>51</td>        <td>52</td>        <td>53</td>        <td>54</td>    </tr>    <tr>        <td>61</td>        <td>62</td>        <td>63</td>        <td>64</td>    </tr></table></body></html>