...

View Full Version : need a quick hand modifying a script to allow the onmouseover of table rows



canadianjameson
08-29-2007, 09:37 PM
Hey,

I have been using a simple img.src changer script to have onmouseover displays (i.e: if you onmouseover an image button, the source of a static pic on the page gets changed so it displays the title of that button, as seen on the vertical black and white buttons here: www.enviromark.ca/head/indexInclude.php)

I am trying to modify it so that i can onmouseover a table row to do the same thing

so far i have


function onStaff1()
{if (!document.images) return; document.infoButton.src = "images/staff/info_BW.jpg"; document.staffPhoto.src = "images/staff/Marlo.jpg";}
function onStaff2()
{if (!document.images) return; document.YPPButton.src = "images/staff/YPP_BW.jpg"; document.staffPhoto.src = "images/staff/Leah.jpg";}
...
and

function offStaff1()
{if (!document.images) return; document.infoButton.src = "images/staff/info_BW.jpg"; document.staffPhoto.src = "images/staff/blankPhoto.jpg";}
function offStaff2()
{if (!document.images) return; document.YPPButton.src = "images/staff/YPP_BW.jpg"; document.staffPhoto.src = "images/staff/blankPhoto.jpg";}


Now the problem here is with the
{if (!document.images) return; document.infoButton.src = "images/staff/info_BW.jpg"; because what i want to do is have the following:



<TR CLASS="MYTABLE" <TR CLASS="MYTABLE" onmouseover="onStaff1()" onmouseout="offStaff1()">
<TD CLASS="MYTABLE">Marlo Turner-Ritchie</TD>
<TD CLASS="MYTABLE">Executive Director</TD>
<TD CLASS="EMAILCELLS"><script>displaycontact(contacts[0], "emails", "text", "")</script></TD>
</TR>

<TR CLASS="MYTABLE" onmouseover="onStaff2()" onmouseout="offStaff2()">
<TD CLASS="MYTABLE">Leah Dolgoy</TD>
<TD CLASS="MYTABLE">Fundraising & Development</TD>
<TD CLASS="EMAILCELLS"><script>displaycontact(contacts[1], "emails", "text", "")</script></TD>
</TR>
<TD CLASS="MYTABLE">Marlo Turner-Ritchie</TD>
<TD CLASS="MYTABLE">Executive Director</TD>
<TD CLASS="EMAILCELLS"><script>displaycontact(contacts[0], "emails", "text", "")</script></TD>
</TR>

<TR CLASS="MYTABLE" onmouseover="onStaff2()" onmouseout="offStaff2()">
<TD CLASS="MYTABLE">Leah Dolgoy</TD>
<TD CLASS="MYTABLE">Fundraising & Development</TD>
<TD CLASS="EMAILCELLS"><script>displaycontact(contacts[1], "emails", "text", "")</script></TD>
</TR>

What do i change the bolded line in the javascript to in order to allow me to do this? The script seems to be coded to only accept the onmouseover of images as a trigger for the source change

canadianjameson
08-29-2007, 09:57 PM
actually hold on, I think I got it

Yup, fixed it meeself :D

Quick question though:

why doesn't this work:

function onStaff1()
{document.staffPhoto.src = "images/staff/Marlo.jpg"; this.bgColor='gold'}

this referring to the table row that I am onmouseover'ing...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum