Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

False HREFS ?

Posted on 1999-07-12
6
Medium Priority
?
228 Views
Last Modified: 2010-04-09
Can someone please give me the correct syntax for false HREFS?

I current use <A HREF="#" ....>

This creates 'bad' navigation history, so I rather not use this method.

Cheers

Antony
0
Comment
Question by:antony061897
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Expert Comment

by:siabod
ID: 1851850
hmm...i always use <A HREF="#bogus" ...> which never gave me problems...
0
 
LVL 9

Expert Comment

by:TTom
ID: 1851851
I have also seen:

<a href="javascript:void()"> (and some variations)

and

<a href="">

Don't know how they affect the History, though.

Tom
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 1851852
A variation of Tom's suggestion:

<a href="javascript:;" onClick='location="myurl.htm";return(true);'>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:antony061897
ID: 1851853
TTom,

Your suggestion worked great.

I didn't use KnightEknight's as I already use the OnClick to call other scripts.

Cheers, submit as answer so I can rate it.

Antony
0
 
LVL 7

Expert Comment

by:nettrom
ID: 1851854
if you're using the onclick-event to fire a script maybe you'd like to either use an empty function in the HREF, or link the HREF to a script letting those without JavaScript know what's going on?

<a href="javascript:myVoid()" onclick=" ... "> with

function myVoid() { ; }

is the void-approach (often seen used by our local JavaScript guru Michel Plungjan).  he creates his own void()-function because some browsers (maybe the older ones) haven't got void().

<a href="otherpage.html" onclick="event();return false;">

is the other approach.  the 'return false' makes sure the link isn't followed for those with JavaScript enabled.
0
 
LVL 9

Accepted Solution

by:
TTom earned 200 total points
ID: 1851855
Antony:

Thanks,

Tom
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question