Solved

Disable hyperlink to prevent double clicking

Posted on 2011-09-13
3
410 Views
Last Modified: 2012-05-12
I want to disable a hyperlink after the user has clicked once. e;g

<a href="dothis.cfm?arg1=a>Cleck me once</a>

Open in new window


I can assume all users re using IE 6 or later.
0
Comment
Question by:kcjuliff
3 Comments
 
LVL 16

Assisted Solution

by:SSupreme
SSupreme earned 83 total points
ID: 36533223
try both:
<a href="dothis.cfm?arg1=a" onclick="isClicked()" id="submitButton">Cleck me once</a>
<a href="dothis.cfm?arg1=a" id='submitButton'  onclick="document.getElementById('submitButton').style.display = 'none';">Cleck me once</a>
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 84 total points
ID: 36533947
simplest one
<a href="javascript:goToURL( this )">Cleck me once</a>

function goToURL( thisObj )
{
    location.href = "dothis.cfm?arg1=a";
    thisObj.removeAttribute("href");
}



0
 

Assisted Solution

by:DJ-Andrey-sXe
DJ-Andrey-sXe earned 83 total points
ID: 36535134
Solution with error message if already clicked.

<a href="http://google.com" onclick="if (this._clicked) { alert('Already clicked.'); return false; } this._clicked = true;" target="_blank">Click me only once</a>

Open in new window


In this example first click opens google, second and all next will do nothing and display alert.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question