Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-16-2005, 07:47 PM   PM User | #1
tr_y2k
New Coder

 
Join Date: Mar 2005
Location: United Kingdom
Posts: 27
Thanks: 8
Thanked 0 Times in 0 Posts
tr_y2k is an unknown quantity at this point
Question Help with changing a table row background

hello, i am trying to change the background color & the text color of each row in a table as the mouse does a mouseOver event. How do i go about making the row change the style from one to the other and then back again when the cursor does a mouseOut event. i am including the table source code below. MenuLinks is the style/class i would like the background of the row and the text inside the row to change to. I am very new to this so any help would be greatly appreciated. many thanx

<table width="122" border="0" align="left" cellpadding="0" cellspacing="0" class="0pxMarginCursor" id="menu_layout1">
<tr onClick="MM_openBrWindow('index_scr.htm','','width=226,height=403')" onMouseOver="class='MenuLinks'">
<td width="18" height="18"><img src="images/a_jpg.gif" width="15" height="15" border="0" align="absmiddle"></td>
<td width="94">New Window</td>
<td width="10">&nbsp;</td>
</tr>
<tr>
<td width="18" height="18"><img src="images/a_htm.gif" width="15" height="15" border="0"></td>
<td width="94">Sage Online </td>
<td width="10">&nbsp;</td>
</tr>
<tr onMouseOver="MM_showHideLayers('menu2','','show')" onMouseOut="MM_showHideLayers('menu2','','hide')">
<td width="18" height="18"><img src="images/a_oth.gif" width="15" height="15" border="0"></td>
<td width="94">Work Files </td>
<td width="10"><img src="images/but_menu_select.gif" name="image_select" width="10" height="10" border="0" align="absmiddle" id="image_select"></td>
</tr>
<tr>
<td width="18" height="18"><img src="images/a_gif.gif" width="15" height="15" border="0"></td>
<td width="94">Open Websites </td>
<td width="10">&nbsp;</td>
</tr>
<tr>
<td width="18" height="18"><img src="images/a_build.gif" width="15" height="15" border="0"></td>
<td width="94">Solar Network </td>
<td width="10">&nbsp;</td>
</tr>
<tr>
<td width="18" height="18"><img src="images/a_drmx.gif" width="15" height="15" border="0"></td>
<td width="94">Global Stats</td>
<td width="10">&nbsp;</td>
</tr>
<tr>
<td width="18" height="18"><img src="images/a_winxp.gif" width="15" height="15" border="0"></td>
<td width="94">Close</td>
<td width="10">&nbsp;</td>
</tr>
</table>
tr_y2k is offline   Reply With Quote
Old 04-16-2005, 08:47 PM   PM User | #2
coothead
Senior Coder

 
coothead's Avatar
 
Join Date: Jan 2004
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 1,551
Thanks: 0
Thanked 195 Times in 191 Posts
coothead will become famous soon enough
Hi there tr_y2k,

here is a script...
Code:
<script type="text/javascript">
<!--
function showRow(el) {
   el.style.background="#800";
   el.style.color="#008";

el.onmouseout=function() {
   el.style.background="";
   el.style.color="";
  }
 }
//-->
</script>
place this snippet in the rows that you want to highlight...
Code:
<tr onmouseover="showRow(this)">
coothead
coothead is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:31 AM.


Advertisement
Log in to turn off these ads.