Advertisement

05.30.2008 at 10:48AM PDT, ID: 23445426
[x]
Attachment Details

Firefox equivalent of window.event

Asked by eChalk in JavaScript, Firefox Web Browser

I have an element on my page that calls a function and passes the click event to that function.  I have no control over either that element or that function.  That function then calls my function, but does not pass the event to my function.  In my function, I need to find out if the shift key was held down when the element was clicked.  As can be seen in the code snippet, using window.event to get a reference to the event works in IE, but fails in firefox.  How do I reference the event from the function I control, the one that does not have the event passed to it?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
<script>
function IDoNotControlThisFunction(e){
	test2();
}
function IControlThisFunction(){
	alert(window.event.shiftKey);
}
</script>
<input type='button' onclick='IDoNotControlThisFunction(event);' />
[+][-]05.30.2008 at 11:36AM PDT, ID: 21680301

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.30.2008 at 11:42AM PDT, ID: 21680355

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.30.2008 at 11:47AM PDT, ID: 21680386

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.30.2008 at 11:54AM PDT, ID: 21680441

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.30.2008 at 11:59AM PDT, ID: 21680478

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.30.2008 at 12:22PM PDT, ID: 21680676

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.30.2008 at 12:25PM PDT, ID: 21680702

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Firefox Web Browser
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628