Sonia
Sonia

Reputation: 253

How to pass event data with a call declared into tag?

i've this element

<img onclick=zoomaImmagine(this) src="images/icon.png"/>

The problem is that i need to pass the event data too for retrieve the mouseX position. I tryied to write

onclick=zoomaImmagine(this,evt)

but the result is that it's undefined Any solution?

Upvotes: 0

Views: 78

Answers (1)

Harsha Venkataramu
Harsha Venkataramu

Reputation: 2914

You could try

zoomaImmagine(this,event)

Since you were using evt,JavaScript was not able to determine what evt meant and hence, it was throwing the undefined error

Upvotes: 5

Related Questions