Highlight table row

Source: Internet
Author: User

Http://www.codeave.com/javascript/code.asp? U_log = 7070.

Outside of the Web, bookmarks were useful for faster more things than just keeping a spot in a book. one thing you can use them for was to scan down lines of text to match up items before ss a page. some rather large HTML tables have the failing that by the time you look or scroll to the right you 've forgotten what item on the horizontal you were looking. in an effort to remedy this you can utilize a couple of simple Javascript commands in your table to highlight a specific row, so there is no mistaken what information belongs where. in this example we utilize the career statistics of Hank Greenberg. when you mouse pointer hovers over any portion of the table that row (or year) background color will change from white to Gray. once off that row or the table entirely the row will return to white.

<HTML>
<Title> codeave.com (hightlight row IE) </title>
<Body bgcolor = "# ffffff">
<Table border = 1 align = center>
<Caption> Hank Greenberg career Statistics </caption>
<TH> year </Th>
<TH> Team </Th>
<TH> AVG </Th>
<TH> AB </Th>
<TH> r </Th>
<TH> H </Th>
<TH> double </Th>
<TH> Triple </Th>
<TH> HR </Th>
<TH> RBI </Th>
<TH> BB </Th>
<TH> SO </Th>
<TH> Sb </Th>
<Tr onmouseover = "This. bgcolor = '# c0c0c0'" onmouseout = "This. bgcolor = '# ffff'" bgcolor = "# ffffff">
<TD align = right> 1938 </TD>
<TD align = right> Detroit </TD>
<TD align = right>. 315 </TD>
<TD align = right> 556 </TD>
<TD align = right> 144 </TD>
<TD align = right> 175 </TD>
<TD align = right> 23 </TD>
<TD align = right> 4 </TD>
<TD align = right> 58 </TD>
<TD align = right> 146 </TD>
<TD align = right> 119 </TD>
<TD align = right> 92 </TD>
<TD align = right> 7 </TD>
</Tr>
<Tr onmouseover = "This. bgcolor = '# c0c0c0'" onmouseout = "This. bgcolor = '# ffff'" bgcolor = "# ffffff">
<TD align = right> 1939 </TD>
<TD align = right> Detroit </TD>
<TD align = right>. 312 </TD>
<TD align = right> 500 </TD>
<TD align = right> 112 </TD>
<TD align = right> 156 </TD>
<TD align = right> 42 </TD>
<TD align = right> 7 </TD>
<TD align = right> 33 </TD>
<TD align = right> 112 </TD>
<TD align = right> 91 </TD>
<TD align = right> 95 </TD>
<TD align = right> 8 </TD>
</Tr>
<Tr onmouseover = "This. bgcolor = '# c0c0c0'" onmouseout = "This. bgcolor = '# ffff'" bgcolor = "# ffffff">
<TD align = right> 1940 </TD>
<TD align = right> Detroit </TD>
<TD align = right>. 340 </TD>
<TD align = right> 573 </TD>
<TD align = right> 129 </TD>
<TD align = right> 195 </TD>
<TD align = right> 50 </TD>
<TD align = right> 8 </TD>
<TD align = right> 41 </TD>
<TD align = right> 150 </TD>
<TD align = right> 93 </TD>
<TD align = right> 75 </TD>
<TD align = right> 6 </TD>
</Tr>
<Tr onmouseover = "This. bgcolor = '# c0c0c0'" onmouseout = "This. bgcolor = '# ffff'" bgcolor = "# ffffff">
<TD align = right> 1941 </TD>
<TD align = right> Detroit </TD>
<TD align = right>. 269 </TD>
<TD align = right> 67 </TD>
<TD align = right> 12 </TD>
<TD align = right> 18 </TD>
<TD align = right> 5 </TD>
<TD align = right> 1 </TD>
<TD align = right> 2 </TD>
<TD align = right> 12 </TD>
<TD align = right> 16 </TD>
<TD align = right> 12 </TD>
<TD align = right> 1 </TD>
</Tr>
<Tr onmouseover = "This. bgcolor = '# c0c0c0'" onmouseout = "This. bgcolor = '# ffff'" bgcolor = "# ffffff">
<TD align = right> 1942 </TD>
<TD align = right> Detroit * </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
<TD align = right> 0 </TD>
</Tr>
<Tr onmouseover = "This. bgcolor = '# c0c0c0'" onmouseout = "This. bgcolor = '# ffff'" bgcolor = "# ffffff">
<TD align = center colspan = 2> total </TD>
<TD align = right>. 313 </TD>
<TD align = right> 5193 </TD>
<TD align = right> 1051 </TD>
<TD align = right> 1628 </TD>
<TD align = right> 379 </TD>
<TD align = right> 71 </TD>
<TD align = right> 331 </TD>
<TD align = right> 1276 </TD>
<TD align = right> 852 </TD>
<TD align = right> 844 </TD>
<TD align = right> 58 </TD>
</Tr>
</Table>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.