wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes how to make a link readonly? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to make a link readonly?" Watch "how to make a link readonly?" New topic
Author

how to make a link readonly?

Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Hi,

How can i make a link readonly or disabled in html depending on certain conditions(The wordings of the link should be visible,but the link should be deactivated).
[ April 10, 2007: Message edited by: Bear Bibeault ]

- Christian
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

This is the simple way to do this.



use onclick event instead of "onklick"


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
i want to make this link disabled in the same way we would make a radio button or a text field etc..
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

I am not sure if there is another way to disable the link.
The only way i know is to disable the link, you need to add an onclick and return false.
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

This may not be the most efficient way of doing it, but put your link inside a <div> tag, and then create a function to change the innerHTML of that tag.



Mike Firkser
Rutgers '84
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60783
    
  65

You can short-circuit the event in a number of way (Saif showed you one) and can use CSS to make it appear "grayed out", if that's what you mean.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to make a link readonly?
 
Similar Threads
textarea and conditional READONLY
How to set readonly attribute for a dynamically created text item?
How to make a dynamaically created text field readonly?
file permission
textfield readonly ?