[thelist] Removing a link with JavaScript.

Chris Marsh chris at webbtech.co.uk
Mon Nov 18 06:42:00 CST 2002


Craig

> Is it possible with JavaScript to un-link a link?
>
> If I had the following:
>    <.a href="test.htm" name="lnkTest">Test<./a>
> Using JS, how do I un-link it so Test is not an active link
> when hovered over?

Why would you want to hardcode a link that only actually links when the
keyboard is used to navigate? I suspect you're actually trying to
achieve something else that can probably be done using a different
method...

> I've tried the following script but it just changes the href value:
>    <.script language="javascript">
>        document.links[0].href="";
>    <./script>
>
> Is it possible?

I'm pretty sure that if you include onclick='return false;' in the
anchor tag you will achieve what you appear to want. Why not give us
some context?

Regards

Chris Marsh





More information about the thelist mailing list