Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2162
  • Last Modified:

Anchor Tag

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
vsaritha_9
Asked:
vsaritha_9
  • 3
  • 2
  • 2
  • +2
1 Solution
 
COBOLdinosaurCommented:
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
 
lexxwernCommented:
or

<a nohref> . . . </a>
0
 
knightEknightCommented:
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!

 
knightEknightCommented:
... 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
 
svd2002Commented:
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
 
lexxwernCommented:
omg,    svd2002 do you really believe that is


               U S A B L E


???


and btw its better to use visibility than diplay.
0
 
COBOLdinosaurCommented:
Even if it was usable, it would not be cross browser. Might even crash NS4.x

Cd&
0
 
vsaritha_9Author Commented:
Thanks a lot,
It was helpful for us
Saritha
0
 
lexxwernCommented:
oh my god!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now