The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

DOM equivalent of window.event.srcElement;

Apparently this is because my JavaScript code does nto conform to the DOM. How am I to change the following code to be compatible with Netscape (it always has and continues to work in IE). I have highlighted the two sections that I belive there will be an issue with. Thanks!

I didn't really look at your page, but from your code snippet, I think I know what you need. In DOM, the equivelent is event.target. But unlike IE's event.srcElement, it also returns text, so we can check to make sure it's not text that we're retrieving (if it is, then we take it's parent). Here's what you code should look like:

Anarchos is right about it not working for NN 4. I've written a proposed article on dHTML/DOM subject for sitepoint. Included in that article is this topic. However, I'll include the code I use for the tutorial for NN 4. Hopefully you can figure it out:

Basically, if I want that code to work in both IE5 and Netscape6 you're saying that I have to include clumsy if/else statements for each browser? That's really clunky and there' got to be a better way to get the same code to work on both.

Microsoft says that their JScript conforms to the standard. Of course Netscape's implementation will conform to the standard. Why can't I write the code once if they're both standards compliant?

I also don't understand one part of your code - what am I supposed to pass through to the script, what is 'e' supposed to be? Since I'm calling the script whenever an onClick event occurs what am I supposed to include?