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 586181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:04:50+00:00 2026-05-13T15:04:50+00:00

Ok, I have been trying to figure this out for a long time now

  • 0

Ok, I have been trying to figure this out for a long time now and finally have the time to investigate. As the title suggests “What is the difference”? I know that this works the way I want it to.

    addLoadEvent(converter);

// Converter
function converter() {
    var pixels = document.getElementById("pixels");
    pixels.addEventListener("keyup", updateNode, true);
    pixels.addEventListener("keydown", updateNode, true);
}

But this doesn’t, and only runs once.

    addLoadEvent(converter);

// Converter
function converter() {
    var pixels = document.getElementById("pixels");
    pixels.onkeydown = updateNode;
    pixels.onkeyup = updateNode;
}

What I’m I lacking… What is the difference? Any links to the topic would be helpful.

My assumption was that the handler should act like the listener but it doesn’t. In fact does a listener even need to be added to the addLoadEvent function?

  • 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-13T15:04:50+00:00Added an answer on May 13, 2026 at 3:04 pm

    addEventListener adds an event handler function to the event. There can be an unlimited number of event handlers this way.

    Setting onxxxxx sets the event handler to that one function.

    From the Mozilla Developer central:

    addEventListener registers a single event listener on a single target. The event target may be a single node in a document, the document itself, a window, or an XMLHttpRequest.

    To register more than one event listeners for the target, call addEventListener for the same target but with different event types or capture parameters.

    And see this chapter of the same document for a comparison of the old onxxxx way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to figure this out for way to long tonight. I
I have been trying to figure this out for some time. It seems lots
I have been trying to figure out whats wrong for quite long time yet
For a long time i have been trying to figure out what is the
I have been trying to figure this out for quite a while, but what
So I have been trying to figure this out for a while, but nothing
I have been pulling my hair trying to figure this out but nothing is
I have been trying to figure out why I am getting this problem and
I have been scratching my head for hours trying to figure out why this
I've been pulling out my hair trying to figure this problem out. I have

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.