event handler in Firefox
Posted: Wed Mar 30, 2005 1:10 pm
I've been banging my head on my desk all morning and bugging the he|| out of Feyd to help me with this, but I just can't seem to find a solution:
I have some js that works fine in IE to create a growing div when I click on an element on my page. It grows right where the mouse was clicked as you can see with this:
that *obviously* doesnt' work in FF as event.clientX nor any "event" stuff works.
I found this:
after some arduous searching but I'm not sure how to implement that into my model.
basically I just need to detect whether it's ff or not (can alraedy to that on my own) and then provide the appropriate code to determine where on the page the mouse was clicked to start growing my div.
this is only my first hurdle but I wanna do this in baby-steps.
THANKS!
Burr
...yes aware I am it's yoda-speak day, but too lazy I was to write all of this up in yoda-speak and make sure you understood it all I did.
I have some js that works fine in IE to create a growing div when I click on an element on my page. It grows right where the mouse was clicked as you can see with this:
Code: Select all
(horz == "e;left"e; ? th.left=event.clientX - 50 : th.left=event.clientX - 100);
(horz == "e;left"e; ? th.top=event.clientY - 60 : th.top=event.clientY);I found this:
Code: Select all
function addEvent(obj, evType, fn, useCapture){
if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("e;on"e;+evType, fn);
return r;
} else {
alert("e;Handler could not be attached"e;);
}
}basically I just need to detect whether it's ff or not (can alraedy to that on my own) and then provide the appropriate code to determine where on the page the mouse was clicked to start growing my div.
this is only my first hurdle but I wanna do this in baby-steps.
THANKS!
Burr
...yes aware I am it's yoda-speak day, but too lazy I was to write all of this up in yoda-speak and make sure you understood it all I did.