chandramohan.mani@gmail.com wrote:
[color=blue]
> Does Event handlers work in netscape.[/color]
Yes, event handlers work in Netscape, depending on the Netscape version
not all event handlers specified in HTML 4 might work but with Netscape
6/7 there is certainly support for HTML 4 and for DOM Level 2 Events.
[color=blue]
> <HTML><SCRIPT LANGUAGE="JScript">
> function mouseclick() {
> alert("I was clicked on " + window.event.srcElement.tagName);[/color]
Have you checked the JavaScript console? It probably shows you that
window.event
is undefined or not an object with Netscape 6/7
[color=blue]
> <BODY onclick="mouseclick()">[/color]
so the problem is not that the onclick handler is not being fired but
that your script being called then throws an error.
You can pass the event object to a function e.g.
<body onclick="mouseclick(event);">
and then you need to process that argument in the function e.g.
function mouseclick (evt) {
and then you need to be aware that properties of the event object differ
in IE and in Netscape, IE docs are here:
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_event.asp>
Netscape 6/7 implements the W3C DOM as given here:
<http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event>
<http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-UIEvent>
<http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent>
You already got an answer showing to access target with Netscape (or
other browser supporting that) and srcElement with IE (or other browsers
supporting that).
--
Martin Honnen
http://JavaScript.FAQTs.com/