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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:10:58+00:00 2026-05-13T00:10:58+00:00

I have a html page, on this page there are some images, when the

  • 0

I have a html page, on this page there are some images, when the user clicks on one of these images, a different image replaces it.

<img style="cursor:hand" src="../_Img/click_me.png" onclick="ChangePic();">

The ChangePic() function:

function ChangePic() {
var el = event.srcElement;
el.src = '../_Img/Clicked.png';}

I also have a label on the page which dispalys the current action, e.g. Move/Right Click/Left Click/ Double Click.

In my onload of the html page, i have:

onmousemove="ShowAction('Move');" onmousedown="ShowKeysDown('Left','Middle','Right','click');"

Show action simply changes the label. The ShowKeysDown checks which button has been clicked, then calls ShowAction. (The strings in this call are for multi-language support)

Problem I am having is that when a user clicks on the image with a single left mouse click, the image correctly changes, the label is chaged to ‘Left Click’ for a fraction of a second, then it changes to ‘Move’ even though no moving has taken place. I thought that it might be that a single click on an image is regarded as the start of a drag and drop procedure but I am not sure.

Edit: When a user does not click on an image, and just in some random whitespace, the label is correctly displayed as ‘Left Click’ until they move the cursor, then it changes to ‘Move’. This is the behavour I would like when clicking on the images.

Thanks for your time.

Note: this only needs to work in IE as it is part of a HTMLDialog in mfc.

  • 1 1 Answer
  • 1 View
  • 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-13T00:10:59+00:00Added an answer on May 13, 2026 at 12:10 am

    I presume that the following event happens by user interaction :

    1. user moves mouse over the image – onmousemove – displays ‘Move’ on the label
    2. user clicks on image (left button click) – onmousedown – diaplsya ‘Left Click’ on the label
    3. user moves mouse out of the image – onmousemove – displays ‘Move’ on the label

    The onmousemove will fire even user moves the mouse just a pixel on the image.

    So the solution for your problem would be :

    1. Have a global flag
    2. Set it in the event handler of onmousedown
    3. Check that flag in event handler of onmousemove, if it is not set then display ‘Move’ on the label and if it is set then do not do anything
    4. Have an event hanlder of onmouseout, reset the flag in this event handler, so again whenever onmousemove fires, it will check the flag and since it has not been set by click event, onmousemove will display ‘Move’ on the label.

    Hope this is what you wanted as behaviour !!!

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

Sidebar

Related Questions

I have a page with this HTML: <p> <img src=images/ih01.jpg width=80 height=110 align=left />
This one is weird, I have a page that consists of a html table
I made this PHP chatbox which supports some JavaScript code. I have these 'images'
I have a HTML page with which I want to do some client side
Suppose I have one html page with frames. The left frame is simply a
I have this html page which globally exists of div , section , and
I have a webBrowser Control. HTML inside webBrowser control displays some small images (4kb
I have the need to render some html text (not an html page with
I have an HTML page (say welcome.html) which contains an iframe to a page
I have a HTML page that scrolls up and down (not a lot, but

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.