• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disable a link a href

 
Gayatri Sinha
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I am trying to disable the link
<a href="http://www.google.com" disabled="true">Click here</a>

But when I click on "Click here" the link works, looks like only the text is greyed.
How do I disable the link?

I have this in a jsp page which has a boolean bit
So I want to do something like

<a href="http://www.google.com" disabled="<%= bit>">Click here</a>

Is this possible?

Thanks
 
Christian Gross
Author
Ranch Hand
Posts: 85
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following

<a href="/whatever" onclick="return false" />


Christian
 
Kj Reddy
Ranch Hand
Posts: 1704
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you disable hyper link its just becomes normal text right? If you want to open a page on some condition write a java script function and call it from href. If the condition satisfied you open page otherwise just do nothing.

code looks like this:

<a href="javascript: openPage()" disabled="<%= bit>">Click here</a>

and function:
function openPage()
{
if(some conditon)
opener.document.location = "http://www.google.com";
}
else{
// nothing, this else not required
}
}

hope it is helpful to you
[ February 24, 2006: Message edited by: KJ Reddy ]
 
Gayatri Sinha
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
great thanks a lot
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic