简体   繁体   中英

Event is not defined” in firefox.

I notice some post, tried evt.pageX window.event.pageX but I is not work.

var curr_elem = [[0,0],[0,0]];

$("*").click(function(){ 

            curr_elem[0][0]=event.pageX-pageXOffset;
            curr_elem[0][1]=event.pageY-pageYOffset;
            $("#lable5").text("X "+curr_elem[0][0]);
            $("#lable6").text("Y "+curr_elem[0][1]);

    });

Or maybe exist better way to get mouse XY inside "click" event. Its working on Chrome and IE. What I'm doing wrong?

pass event in a function

$("*").click(function(event){ 

NOTE: some of the browser does not get event ,so you have to pass e ,

event is not defined. you're not passing a parameter to the callback within the click handler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM