PDA

View Full Version : Javascript Probs



Gimped
Oct 8th, 2002, 08:33 AM
I am trying to create a rollover effect that changes the BG colour of a cell in a table. I've kind of got it working, but not completely.

Here is the javaScript I have right now:

function change(color){
var el=event.srcElement
if (el.tagName=="TD")
event.srcElement.style.backgroundColor=color
}

I also have a stylesheet set up that sets the BG colour. What this code does is change the bg colour on a rollover of the cell, but it only works on the actual cell. So when you rollover the text that is linked, it doesn't work.

Please keep in mind that I am NOT an avid JS coder. I know very little, which is why I need help :)


Any ideas?

akashik
Oct 14th, 2002, 07:30 AM
This tutorial should help you out:

http://www.pageresource.com/dhtml/jtut6.htm

Just edit it to your requirements and you should be fine. It has a netscape fix too.

Greg Moore