473,388 Members | 1,198 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

disable a link

i have a hyper link when u click on the link it opens a new browser in a new window.how do i disable the link once the link is clicked.Thnaks for your help

Thanks
Prathna
May 28 '08 #1
2 1895
Markus
6,050 Expert 4TB
i have a hyper link when u click on the link it opens a new browser in a new window.how do i disable the link once the link is clicked.Thnaks for your help

Thanks
Prathna
Have the link in a span with an id
onclick of the link change the innerHTML of the id

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function disable()
  3. {
  4.  
  5.     document.getElementById('thelink').innerHTML = 'click me!';
  6.  
  7. }
  8. </script>
  9.  
  10. <span id="thelink"><a onclick="disable()" href="#">click me!</a></span>
  11.  
May 28 '08 #2
hsriat
1,654 Expert 1GB
Or add this code to the onclick event of the hyperlink..

[HTML]<a href="location.xyz" onclick="this.onclick=function () {return false;}" target="_blank">One time clickable link</a>[/HTML]

If you have already calling some other function on click event, add that above line after calling that function.
May 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: KS | last post by:
Im trying to prevent the user from clicking any other links on my page when the user have selected/clicked a href once. Sometimes it takes a while before the next page loads so some user will try...
32
by: Mark Johnson | last post by:
You have an, a, anchor with href link. Can you use a stylesheet to effectively disable the link, so that you can't click on it; that it will appear simply as text?
6
by: nntp | last post by:
I have a set of links which I want search engines to crawl them, but I want to disable them from my visitors, so I will ask the link owners to pay me to let me enable them. <a disabled...
4
by: Jamie Jackson | last post by:
I know that it's possible to return false in an onClick to disable a link. Is there a way to do this within the HREF attribute? Something like: <a href="javascript: return false;"> ? Thanks,...
4
by: kschneider | last post by:
Assume there's a form with it's action attribute all set to post to a URL, but without a submit control. Form submission is done via a link and I want to prevent the classic "double submit"....
0
by: rn5a | last post by:
In a shopping cart app, assume that a user has placed 4 orders (each order has a corresponding OrderID which will be unique). When he comes to MyCart.aspx, by default, the details of his last order...
1
by: David Henderson | last post by:
I know 'disable-output-escaping' has been discussed in the past, but I can't put my finger on any of the threads to see if my current problem is addressed. Sorry for re-asking the question if it...
3
by: =?Utf-8?B?UGxhdGVyaW90?= | last post by:
I have link buttons in a Gridview that, depending on the value in another column (Not the Key column) will need to be disabled. For example, (Column2 has link buttons) Column1 ...
1
by: wolf18 | last post by:
I am running a business and I have a forum on it but I do not want under 18's to access it due to that its for booking and to hire, anyway what ive done is ive created a link that says "Leave (Iam...
1
by: burtonfigg | last post by:
I have a very simple bit of ajax with next / prev links on it (thanks to acoder who helped a lot with getting it to work): http://jimpix.co.uk/e.asp If I am at the start of the range, is there...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.