links to open just on double click

February 24, 2008 at 09:45:04
Specs: winxp, 500

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)


See More: links to open just on double click

Report •


#1
February 24, 2008 at 10:08:28

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


Report •
Related Solutions


Ask Question