wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Disable an image anchor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disable an image anchor" Watch "Disable an image anchor" New topic
Author

Disable an image anchor

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi,

Is there a JS function to dynamically disable an image anchor
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

What do you mean by 'image anchor'? Code please.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
I want to dynamically disable the hyperlink for an image and the onclick should be disabled
[ September 18, 2005: Message edited by: Mary Cole ]
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
I have an image with somecode in the onClick event and I have another select box and have some code in the onChange event. On selecting a different value in the selectbox, I want the above image anchor/hand cursor to be disabled so that I cannot click it during the time the page refreshes.

Can anybody throw some light on this.
Thx
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
then remove the onclick event

document.getElementById("asdf").onclick = NULL

Eric
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi,

I added this code, but the hand cursor still remains and confuses the user.Is there a way to remove the hand cursor?
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
You can have 2 div tags with the same data. One div tag can have the link, and the other without the link. Only one div tag should be shown at a time
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

You can change the cursor using the CSS cursor rule.
 
 
subject: Disable an image anchor