FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

JavaScript Tutorial: Dynamically changing the color of a row or cell using CSS & Javascript

jawahar
11/6/2005 5:13:40 AM, Views: 2381
The following code/tutorial shows how to change the color of a cell/row on mouseover(moving the mouse over the cell)

<HTML>
<HEAD>
<script language=JavaScript>
function rowOverEffect(object) {
   if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rowOutEffect(object) {
   if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}
</script>

<STYLE>
.dataTableHeadingRow { background-color: #C9C9C9; }
.dataTableHeadingContent { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; }
.dataTableRow { background-color: #F0F1F1; }
.dataTableRowSelected { background-color: #DEE4E8; }
.dataTableRowOver { background-color: #00A5BA; cursor: pointer; cursor: hand;}
.dataTableContent { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; }
</STYLE>
</HEAD>
<BODY>
<table border="0" width="100%" cellspacing="1" cellpadding="2">
<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
<td class="dataTableContent" height=30 align="right">This tutorial shows how to change the color of a cell/row on mouseover</td>
</tr>
<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
<td class="dataTableContent" height=30 align="right">The mouseover effect can be seen when the mouse is moved over the cell</td>
</tr>
<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
<td class="dataTableContent" height=30 align="right">and also when it is moved out of the cell</td>
</tr>
</table>
</BODY>
</HTML>
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Avg Visitor Rating: Average Visitor Rating is 5 out of 5
Number of Ratings : 1 Votes
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
JavaScript RSS Feed
Most Popular Tutorial
Most Popular Solution
Top Rated
Top Rankers
Overall
1. jawahar (1400)
Yearly -2008
1. jawahar (200)
Expertsforge Sponsors
bnrtop