Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1365 How can I make a link unclickable after it is clicked?

You are here: irt.org | FAQ | JavaScript | Link | Q1365 [ previous next ]

Try the following, although it is only of use if targeting another frame or window:

<script language="JavaScript"><!--
function disable(href) {
    for (var i=0; i<document.links.length; i++) {
        if (document.links[i].href == href) {
            document.links[i].href = 'javascript:;';
            document.links[i].onclick = '';
        }
    }
}
//--></script>

<a href="http://www.irt.org" target="_blank" onClick="setTimeout('disable(\'' + this.href + '\'),100')">irt.org</a>
<br>
<a href="http://www.irt.org" target="_blank" onClick="setTimeout('disable(\'' + this.href + '\'),100')">irt.org</a>

If you need to stop it permanently, then you'll need to set a cookie.

Feedback on 'Q1365 How can I make a link unclickable after it is clicked?'

©2018 Martin Webb