Solved

Anchor Tag

Posted on 2002-06-11
9
2,158 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
[X]
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
  • 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
Technology Partners: 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!

 
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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Rotate images for Web Page 11 40
SharePoint and CAML query help 4 26
XML loaded in a form with dropdown 6 55
Different Javascript on iPhone than Win 10 desktop? 7 54
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
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…

734 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