Re: aPossible to Make A "Dummy" Anchor Tag **without** Jumping Back Up???

Giganews Newsgroups
Subject: Re: aPossible to Make A "Dummy" Anchor Tag **without** Jumping Back Up???
Posted by:  Stanimir Stamenkov (s7an…
Date: Fri, 02 May 2008

[Note: follow-up to comp.lang.javascript]

Thu, 1 May 2008 16:16:49 -0700 (PDT), /Prisoner at War/:

> Is it possible to have an "empty" or "dummy" <a href> ***without***
> the browser jumping back up the page??
> I have a hyperlink that doesn't point to another document, but is used
> to call forth a modal window onClick (or is there another way, without
> text or image links, of calling forth JavaScript on user activity??).
> I would like to spare my visitors the inconvenience and visually
> jarring effect of getting thrown back up to the top of the page!  =(

If the element is not really a hyper link why marking it as such?
Better use generic SPAN element or A(nchor) element without 'href'
and attach 'click' handler to it. This will spare your visitors the
confusion with encountering hyper links which are not really hyper

Apart from that from the incorrect hyper link usage note, you could
always return false in the 'click' handler to prevent the browser
from doing its default action - to follow the link:

  <script type="text/javascript">
    function openWindow(url, name, features) {
      if (open) {
        var n = (name) ? name : "_blank";
        var f = (features) ? features : "resizable,scrollbars";
        var win = open(url, n, f);
        if (win) {
          return false;
      return true;

<a href="
onclick="return openWindow(this.href);">W3C</a>




In response to

aPossible to Make A "Dummy" Anchor Tag **without** Jumping Back Up??? posted by Prisoner at War on Thu, 1 May 2008