表格交替变色
一个表格交替变色的方法,还有一个朋友的网站,上面有好多不错的电子书,喜欢dw和fl的朋友可以去逛逛。http://dsp.blueidea.com/thinkfuse/index.asp
<html><head><title>表格交替变色</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">.t1 { background: red;}.t2 { background: green;}</style><script>function TrChange(tbody){ for(i=0;i<tbody.rows.length;i++) { if(i%2==0) { tbody.rows[i].className="t1" } else { tbody.rows[i].className="t2" } }}window.onload=function(){ TrChange(document.getElementById("test"))}</script></head><body><table><thead><tr> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td></tr></thead><tbody id="test"><tr> <td>1</td> <td>1</td> <td>1</td> <td>1</td> <td>1</td></tr><tr> <td>2</td> <td>2</td> <td>2</td> <td>2</td> <td>2</td></tr><tr> <td>3</td> <td>3</td> <td>3</td> <td>3</td> <td>3</td></tr><tr> <td>4</td> <td>4</td> <td>4</td> <td>4</td> <td>4</td></tr></tbody></table></body></html>
0 评论
Recommended Comments
没有要显示的评论。
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new account登录
Already have an account? Sign in here.
现在登录