Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why dosent this simple JavaScript work?

Status
Not open for further replies.

Naits

Programmer
Oct 10, 2001
90
NO
I'm trying to make an OnMouseOver background change in a <td>. This is the function i'm using:
------------------------------
function flipbg(element,mode)
{
if (mode==&quot;over&quot;)
{
cursortype = 'hand'
picture = 'images/menu-over.gif'
}
else if (mode==&quot;out&quot;)
{
cursortype = ''
picture = 'images/menu-normal.gif'
}
element.style.background=picture;
element.style.cursor=cursortype;
}
----------------------------------------
And this is how I call the function:
----------------------------------------
<tr><td background=&quot;images/menu-normal.gif&quot; onmouseover='flipbg(this,&quot;over&quot;);' onmouseout='flipbg(this,&quot;out&quot;);' align='left'> Link Text!! </td></tr>
-------------------------------------------
But it's not working. What have I done wrong?

Thanks! __________________
Visit my homepage
.: Game universE :.
 
replace:

element.style.background=picture;


with

element.background=picture;


background is an attribute of the TD tag so you dont go thru the style collection.
 
can you post your style coding
that is where the problem is. I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Sorry, didn't see the reply's I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top