Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Anchor Tag

Posted on 2002-06-11
9
2,156 Views
Last Modified: 2012-06-27
Hi all,
Here is my problem.I want to Disable few links in my menu. I am using anchor tags. Is there any way to disable anchor tags so that i can enable them later.I have tried with disabled feature but it did not work..Is there any alternate solution for this.
Hope to see quick responses from you all.
Thanks a lot in advanced.
With regards
saritha
0
Comment
Question by:vsaritha_9
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7069670
If by disabled you mean you want the link to show but not go anywhere, then do it this way:

<a href="#">yourtext</a>

If it is something else you are trying to do please tell us what behaviour you want when it is "disabled".

Cd&
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7069754
or

<a nohref> . . . </a>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7069767
you could use the onClick handler to return false ... this would have the effect of disabling the link:

<a href="whatever.html" onClick='return false;'>yourtext</a>
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 33

Expert Comment

by:knightEknight
ID: 7069771
... and you could set up a global variable to determine whether or not your links are disabled:

<SCRIPT language='javascript'>
  var linksEnabled = true;
</script>


<a href="whatever.html" onClick='return linksEnabled;'>yourtext</a>

... set linksEnabled to false to disable the links.
0
 
LVL 2

Accepted Solution

by:
svd2002 earned 50 total points
ID: 7071977
You can hide the link whenever you want to disable it and display just the text instead of link like this:

<A href="http://wwww.hotmail.com" id="TestLink">Test Link</A>
<SPAN id=spnTemp></SPAN>
<INPUT type="button" name="btnDisable" id="btnDisable" value="Disable Link" onClick="TestLink.style.display='none';spnTemp.innerHTML='<U>Test Link</U> ';">
<INPUT type="button" name="btnEnable" id="btnEnable" value="Enable Link" onClick="TestLink.style.display='';spnTemp.innerHTML='';">
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7071992
omg,    svd2002 do you really believe that is


               U S A B L E


???


and btw its better to use visibility than diplay.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7072514
Even if it was usable, it would not be cross browser. Might even crash NS4.x

Cd&
0
 

Author Comment

by:vsaritha_9
ID: 7075557
Thanks a lot,
It was helpful for us
Saritha
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7077225
oh my god!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Button and js nou working 3 19
alert(innerHTML); 8 32
Not allowed to load local recource. 4 34
formvalidation.io validate form on class click 4 13
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

840 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