Forum Moderators: open

Message Too Old, No Replies

The best way to write a NON-LINK?

Alternatives to the "#" (hash link in A HREF)

         

craig1972

12:03 pm on Apr 19, 2003 (gmt 0)

10+ Year Member



How to write a non-link or a dead / void link?

I have tried the following:

1. href="javascript://"
2. href="javascript:return false"
3. href="javascript:void()"
4. href="#"

But none of these are satisfactory -- e.g., the 4th one always points to the top of the page, the 1st one is "inaccessible" as the Poodle predictor tells me.

Any thoughts?

Glacai

12:18 pm on Apr 19, 2003 (gmt 0)

10+ Year Member



How about <a href="#" onclick="return false;">.

ShawnR

12:21 pm on Apr 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What are you trying to do? What is the effect you require?

craig1972

12:28 pm on Apr 19, 2003 (gmt 0)

10+ Year Member



Thanks Glacai, but the # takes a user to top of page if JS is diabled.

My intenttion is to have a link that does not point to anything. It should have an onclick but for those who do not have javascript enabled it should point to nothing...also, for those who have js enabled, it should be the best possible (accessible) way of doing things..

korkus2000

12:37 pm on Apr 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How bout

<a name="thisButton"></a>
<a href="#thisButton" onClick="whatever()">Click Here</a>

Glacai

1:07 pm on Apr 19, 2003 (gmt 0)

10+ Year Member



I suppose you could put the name in the same tag as well <a href="#thisButton" name="thisButton" onclick...

Don't know if its ok to do that?

It'll move that position to the top of the page though.

gph

2:06 pm on Apr 19, 2003 (gmt 0)

10+ Year Member



How about not using <a. You can do this with almost any element, here's a span example.


<span class="off" onmouseover="this.className='on'" onmouseout="this.className='off'" onmousedown="foo()">link</span>

Xuefer

2:16 am on Apr 20, 2003 (gmt 0)

10+ Year Member



href="###"
href="javascript:"

sniser

7:49 am on Apr 20, 2003 (gmt 0)

10+ Year Member



Hi, maybe you just use the javascript write function to write the link if js is enabled. Put the same text/pic in the noscript part, only without the link. That's the cleanest way I can think of.