Computing.Net > Forums > Web Development > links to open just on double click

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

links to open just on double click

Reply to Message Icon

Name: ola 2
Date: February 24, 2008 at 09:45:04 Pacific
OS: winxp
CPU/Ram: 500
Comment:

hello,
i want to put some image links on my page that are only open when the user make double click, usually when we do single click on a link , that link opens, buit i don´t want this to happen for this links im trying to make, i want them to open just on double clik, can i do this? thanks! (im using kompozer)



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: February 24, 2008 at 10:08:28 Pacific
Reply:

Why would you want to change the default functionality that EVERYONE is accustomed to? I think it's a bad idea so I wont write the code, but I will suggest a solution.

The only way I can see of doign this is with JavaScript (so any user w/o JavaScript enables will be SOL.

Anyway,t he first thing you would neeed to do is decide how long a double-click should take. I would suggest about 300 milliseconds. Then create a function that will be triggered onclick or onmousedown on the images. The function call should pass a parameter such as the URL of the image to be opened ont he double click.

In the function will first check to see if there was a previous click. If not, it will save this new click (and the time). If there was a previous click it will check if the new click is NOT the same as the last (i.e. a different image) then it will replace teh last click with this new one.
If there was a previous click AND it is the same as the new click check the difference in time. If the difference is less than 300ms then open the link, if not replace the previous click with this one.

Michael J


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: links to open just on double click

Link to files outside Apache on PC www.computing.net/answers/webdevel/link-to-files-outside-apache-on-pc/3383.html

Link to video www.computing.net/answers/webdevel/link-to-video/92.html

linking to spot on page www.computing.net/answers/webdevel/linking-to-spot-on-page/2545.html