|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
Hi, People,
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! =( |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
Ah, well, using "javascript:;" for a value did the trick! The browser no longer throws the viewer back up to the top of the page. Unfortunately, that modal window doesn't center vertically, so *it* is still up at the top of the page! How can I center an element *vertically*, please? It's just a box, actually, and I know that with CSS "auto" centers it horizontally -- but what about vertically?? |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
On 05/01/08 04:16 pm, Prisoner at War wrote:
> > 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??). > You can use the onClick attribute with just about any element. It soes not have to be an anchor. -- jmm (hyphen) list (at) sohnen-moe (dot) com (Remove .AXSPAMGN for email) |
|
|
|
#4 (permalink) |
|
Messages: n/a
Hébergeur: |
On May 1, 7:16 pm, Prisoner at War <prisoner_at_...@yahoo.com> wrote:
> Hi, People, > > Is it possible to have an "empty" or "dummy" <a href> ***without*** > the browser jumping back up the page?? End the JavaScript with "return false;" and that will suppress the jump to the normal href destination. It's then a good idea to make the href value a URL to a separate page with the same content as the attempted popup, so as to make that content accessible to non-JavaScript users. -- Dan |
|
|
|
#5 (permalink) |
|
Messages: n/a
Hébergeur: |
On May 1, 7:16pm, Prisoner at War <prisoner_at_...@yahoo.com> wrote:
> Hi, People, > > 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! =( Try using <a href="#" onclick=" . . . ;return false"> Herbert |
|
|
|
#6 (permalink) |
|
Messages: n/a
Hébergeur: |
[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 links. 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; } </script> <a href="http://www.w3.org/" onclick="return openWindow(this.href);">W3C</a> -- Stanimir |
|
|
|
#7 (permalink) |
|
Messages: n/a
Hébergeur: |
On May 1, 8:19 pm, dorayme <doraymeRidT...@optusnet.com.au> wrote:
> > > Looked at > > <http://www.jakpsatweb.cz/css/css-vertical-center-solution.html> > > ? > > -- > dorayme Hmmm!! Looks interesting! Thanks, this just might be the ticket! I'll have to give it a shot -- but it looks like it will work! (At least I can understand the example in theory!) |
|
|
|
#8 (permalink) |
|
Messages: n/a
Hébergeur: |
On May 1, 8:18 pm, Jim Moe <jmm-list.AXSPA...@sohnen-moe.com> wrote:
> > > You can use the onClick attribute with just about any element. It soes > not have to be an anchor. Ah, yes, thanks; I'd forgotten that! As it is, I do need a hyperlink, though it doesn't point to another document, but to a function that manipulates a <div> or two in order to present a modal window.... > -- > jmm (hyphen) list (at) sohnen-moe (dot) com > (Remove .AXSPAMGN for email) |
|
![]() |
| Outils de la discussion | |
|
|