Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15487

Getting event from map click

Date 2012-08-22 15:10 +1000
From Andrew Poulos <ap_prog@hotmail.com>
Newsgroups comp.lang.javascript
Subject Getting event from map click
Message-ID <t86dnbfJxtcl9KnNnZ2dnUVZ_g2dnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


I have some js like this

var myFunction = function(e, elem) {
  e = e || window.event;
  // do other stuff
};

and some HTML like this

<img id='tmp' src="lake.jpg" style="width:256px; height:192px;" 
usemap="#pnt">
<map name="pnt">
   <area shape="rect" coords="111,36,151,85" href="#" 
onclick="myFunction(e, 'tmp'); return false;">
</map>

I need the 'area' to pass the event to the function and some other 
parameters. When I try the above I get e is undefined. How do I get it 
to pass the event as well?

Andrew Poulos

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Getting event from map click Andrew Poulos <ap_prog@hotmail.com> - 2012-08-22 15:10 +1000
  Re: Getting event from map click Andrew Poulos <ap_prog@hotmail.com> - 2012-08-22 15:22 +1000
    Re: Getting event from map click Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-22 10:48 +0200
      Re: Getting event from map click Andrew Poulos <ap_prog@hotmail.com> - 2012-08-22 22:16 +1000
        Re: Getting event from map click Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-22 16:23 +0200
          Re: Getting event from map click Andrew Poulos <ap_prog@hotmail.com> - 2012-08-23 18:08 +1000
            Re: Getting event from map click Andrew Poulos <ap_prog@hotmail.com> - 2012-08-24 07:25 +1000
        Re: Getting event from map click SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-22 18:09 +0200
  Re: Getting event from map click Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-22 10:46 +0200

csiph-web