PDA

View Full Version : anchor ghosting...


forlamp
05-27-2004, 02:59 AM
Is there a way to disable an anchor with javascript based on an event or loop or something?

like grey it out, or just make it un-clickable.

this would be cool if it was available :)

-fl

agent002
05-27-2004, 06:28 AM
Hi Forlamp,
you can use these functions to enable and disable links:
function disableLink(linkObj){
linkObj.onclick = function(){ return false; }
linkObj.style.cursor = 'default';
linkObj.style.color = 'inherit';
linkObj.style.textDecoration = 'inherit';
}

function enableLink(linkObj){
linkObj.onclick = null;
if(document.all) linkObj.style.cursor = 'hand';
else linkObj.style.cursor = 'pointer';
linkObj.style.color = '';
linkObj.style.textDecoration = '';
}
For instance, if you have an anchor with id="blueberrypie", you can disable it using disableLink(document.getElementById('blueberrypie')).

forlamp
05-27-2004, 02:07 PM
sweet, thanks for the info!

-fl

agent002
05-27-2004, 02:27 PM
No problem. I'm glad I could help.