Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:11:55+00:00 2026-05-23T17:11:55+00:00

I come again with my inabilities to comprehend javascript. I have a draggable library

  • 0

I come again with my inabilities to comprehend javascript.

I have a draggable library and it has a command that is called like so (the _ag is just namespacing stuff):

_ag.drag(event,targetDiv);  
// targetDiv can be a string, btw - converted to an element in the function

so I’ve got code that looks like so (passing some data with a closure – a new trick to me):

header.onmousedown=function(targetDiv){
    return function(){
        _ag.drag(event,targetDiv)
    }

}(aTargetDiv)

works great! just great! in…IE! SF! Chrome! NOT IN FIREFOX!

No, firefox cannot find the event. Now normally this is easy enough with something like this (formed slightly differently – hope it’s still valid):

header.onmousedown=function(event){
    alert(event.screenX)
}

However if I decide to pass some parameters in, it blows away event, which I guess is some sort of invisible parameter in FF?

//broken thing 1:
header.onmousedown=function(event){
    alert(event.screenX)    //  somethingToPass in covers event in FF
}(somethingToPassIn)


// broken thing 2:
header.onmousedown=function(event){
    alert(event.screenX)    
}(event,somethingToPassIn)  // event is undefined

SO FIREFOX: How do I send you events? Here’s hoping this is a very stupid question, and that hoards of SO folks have the answers! Thanks in advance, I’ll be right here banging my head against the wall.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:11:55+00:00Added an answer on May 23, 2026 at 5:11 pm

    Firefox probably doesn’t have support for event, but instead passes it into your function when the event fires. So,

    header.onmousedown=function(targetDiv){
        return function(e){
            e = e || event;  //This will give support for global event and passing the event into the function
            _ag.drag(e, targetDiv);
        }
    }(aTargetDiv)
    

    You don’t need the closure unless the aTargetDiv variable changes sometime later in the code. Instead, you could do:

    header.onmousedown=function(e){
        e = e || event;
        _ag.drag(e, aTargetDiv);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with a situation that I come up again time and time again
Math has come on my way again and has defeated me. I need your
I've just come back to fix some bugs in a small program that I've
I come from a .NET world and I'm new to writting C++. I'm just
I have some filter and one grid.And grid have some buttons like modify/edit.I am
I know how to make all these uiimageviews disappear and come back again, but
I have another problem, and because the reply is to fast here i come
I have a UITableView of UITableViewCells that so far performed well. I now aded
I am just now beginning to research this, and so far haven't come up
I have come unstuck on a relatively (almost) trivial problem. I have a row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.