Re: srcElement in IE = what in Netscape?

Giganews Newsgroups
Subject: Re: srcElement in IE = what in Netscape?
Posted by:  Lasse Reichstein Nielsen (l…
Date: 28 Jul 2003

"Dan" <hgfgh…@dfgd.rf> writes:

> When i click down with the mouse, i want to be sure that the image "myimg"
> is clicked before doing something. With IE i use 'srcElement' and it works:

The official name is "target". Also, there is no "window.event" in
Mozilla/Netscape, that is a Microsoft invention as well.

> <IMG ID="myimg"  SRC="bugs.gif" onMouseDown="downtest()">

> <script>

  <script type="text/javascript">

The type attribute is mandatory.

> function downtestIE()

  function downtest(event) {
    event = event || window.event; // IE doesn't pass event as argument.
    var tgt = || event.srcElement; // IE doesn't use .target
    var strid =;

> if (strid=="myimg")
> { etc ...


Lasse Reichstein Nielsen  -  l…
  'Faith without judgement merely degrades the spirit divine.'


In response to

srcElement in IE = what in Netscape? posted by Dan on Mon, 28 Jul 2003