my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes double click for a href Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "double click for a href" Watch "double click for a href" New topic
Author

double click for a href

samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
helo, from what i know, a href is activated with one mouse click only. Is there any way that the a href is only activated with double click? I'm trying to prevent having to use the javascript as the link is quite complicated to explain here.

please help me. Thank you very very much
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
no there is no way to make it a double click with just html.

Eric
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You could use the onClick event to store the time the link was clicked and increase a "click counter" up to 2.
Comparing the link was clicked the first time, with the time the link was clicked a second time. Wouldn't that be possible ?
Not sure... And if you had to do this for all links, that sounds like a pain.


[My Blog]
All roads lead to JavaRanch
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by Satou kurinosuke:
You could use the onClick event to store the time the link was clicked and increase a "click counter" up to 2.
Comparing the link was clicked the first time, with the time the link was clicked a second time. Wouldn't that be possible ?
Not sure... And if you had to do this for all links, that sounds like a pain.


Samart said "no javascript"

Eric
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Samart said "no javascript"

Dooooooohhh !!

Sorry. So my answer is :

no there is no way to make it a double click with just html.

samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
Originally posted by Satou kurinosuke:
You could use the onClick event to store the time the link was clicked and increase a "click counter" up to 2.
Comparing the link was clicked the first time, with the time the link was clicked a second time. Wouldn't that be possible ?
Not sure... And if you had to do this for all links, that sounds like a pain.


emmmm, what i meant earlier was, i would like to prevent having to use the javascript's location.href...btw, click counter sounds quite interesting. could u give me some example?

TQ
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Sorry, I have not enough knowledge in Javascript to post some script.

The main idea is :
1. Declare an onClick event on your link
2. Use a variable for the click counter and set it to 0
3. Use a variable for the first click time
4. In the onClick event, increment the counter.
If it equals 1, get the current time and it
If it equals 2, get the current time and compare it with the previous click time.

Good luck
Manesh Kumar
Ranch Hand

Joined: Mar 21, 2006
Posts: 94
w3.org states support of ondblclick with HTML 4.0
You can check this link for list of attributes
http://www.w3.org/TR/REC-html40/index/attributes.html

What can be suggested is,
in href and onclick attributes for anchor tag, point to some dummy function and then ondbclick you set document.location.href to your URL.

But do test cross browser compatibility


Manesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: double click for a href