How to change the color of the entire column after moving the mouse over a cell

Source: Internet
Author: User

<Br/> <table width = "80%" border = "0" align = "center" cellpadding = "2" cellspacing = "2" bgcolor = "# f4f4f4" id =" phx "> <tr> <td> </tr> <tr> <td> </tr> <td> </td> </tr> </table> <p>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

The above Code allows you to move the mouse over a cell, and the cell color changes. Now I want to move the mouse over a cell, but the entire column will change color and I don't know if it can be implemented?<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"> <br/> <style> body {font: normal 12px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: # E6EAE9 ;}. mytable {width: 80%; padding: 0; margin: 0 ;}</p> <p>. mytable td {border-bottom: 1px solid # C1DAD7; background: # fff; font-size: 12px; padding: 6px 6px 0px; align: center; color: #4f6b72 ;} </p> <p> td. alt {background: # F5FAFA; text-align: center; color: #797268 ;}</p> <p> td. alt {background: # FFFFFF; text-align: center; color: #000 ;}</p> <p> td. spec {border-top: 0; background: # fff; text-align: center; font: 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif ;} </p> <p> td. specalt {border-top: 0; background: # f5fafa; text-align: center; font: 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #797268 ;}</style> <p> <table class = "mytable" cellspacing = "0" id = "table1" onmouseover = "senfe (this) "onmouseout =" senfe (this) "> <tr> <td class =" alt "height =" 45 "> </td> <td class =" alt "height =" 45 "> </td> <td class = "alt" height = "45"> </td> <td class = "alt" height = "45"> </td> <td class = "alt" height = "45"> </td> </tr> <td class = "alt" height = "45"> </td> <td class = "baialt "height =" 45 "> </td> <td class =" alt "height =" 45 "> </td> <td class =" baialt "height =" 45"> </td> <td class = "alt" height = "45"> </td> </tr> <td class = "alt" height = "45 "> </td> <td class =" baialt "height =" 45 "> </td> <td class =" alt "height =" 45 "> </td> <td class = "baialt" height = "45"> </td> <td class = "alt" height = "45"> </td> </tr> <tr> <td class = "alt" height = "45"> </td> <td class = "baialt" height = "45"> </td> <td class =" alt "height =" 45 "> </td> <td class =" baialt "height =" 45 "> </td> <td class =" alt "height =" 45 "> </td> </tr> </table> <p align =" center "> when the mouse passes, you want to change the color of the column (preferably reversed ), example: </p> <table class = "mytable" cellspacing = "0" id = "table2"> <tr align = "center"> <td class = "baialt" height =" 45 "> </td> <td class =" alt "height =" 45 "> </td> <td class =" baialt "height =" 45 "> </td> <td class = "alt" height = "45"> </td> <td class = "alt" height = "45"> </td> </tr> </table> <p>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

The Code has been posted, and now the mouse moves to the cell to change color
Phx. rows [I]. cells [j]. onmouseover = function ()
{
If (pObj! = This ){
This. bgColor = overcolor ;}
}
And cell color removal
Phx. rows [I]. cells [j]. onmouseout = function ()
{
If (pObj! = This ){
This. bgColor = outcolor ;}
}
All have been solved ·
The remaining problem is phx. rows [I]. cells [j]. onclick: After I click a cell in the table, I hope that the column where the cell is located will change color. What can I do?<Br/> <table width = "80%" border = "0" align = "center" cellpadding = "2" cellspacing = "2" bgcolor = "# f4f4f4" id =" phx "> <tr> <td> </tr> <tr> <td> </tr> <td> </td> </tr> </table> <p>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

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.