473,854 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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! =(
Jun 27 '08 #1
20 2024
Prisoner at War schrieb:
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! =(
Click listeners can be attached to practically *all* elements of a
document. No need for an anchor. And no need for crossposting into all
sorts of groups.

x'posts removed.

Gregor
Jun 27 '08 #2

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??
Jun 27 '08 #3
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)
Jun 27 '08 #4
In article
<19************ *************** *******@m45g200 0hsb.googlegrou ps.com>,
Prisoner at War <pr************ *@yahoo.comwrot e:
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??
Looked at

<http://www.jakpsatweb. cz/css/css-vertical-center-solution.html>

?

--
dorayme
Jun 27 '08 #5
Dan
On May 1, 7:16 pm, Prisoner at War <prisoner_at_.. .@yahoo.comwrot e:
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
Jun 27 '08 #6
On May 1, 7:16*pm, Prisoner at War <prisoner_at_.. .@yahoo.comwrot e:
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
Jun 27 '08 #7
[Note: follow-up to comp.lang.javas cript]

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,scro llbars";
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
Jun 27 '08 #8
On May 1, 8:26 pm, Dan <d...@tobias.na mewrote:
>

End the JavaScript with "return false;" and that will suppress the
jump to the normal href destination.
Good grief! I'd totally forgotten that!!

Yes, it says just so in Chapter 4, Rollover Buttons, of "The Book of
JavaScript, Second Edition!" Damn, in one ear, out the other....
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.
Actually, the href doesn't point to a document, but to text that's
invisible until invoked by an onClick, creating that modal window.

God, what a dilemma! Just what in heck am I supposed to do about
those people (like me!) whose IE7 disabled ActiveX Controls??
--
Dan
Jun 27 '08 #9
On May 1, 8:26 pm, Herbert Blenner <a1ea...@verizo n.netwrote:
>

Try using <a href="#" onclick=" . . . ;return false">

Herbert
Many thanks -- for the reminder! Can't believe I forgot that one....
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
9188
by: Prisoner at War | last post by:
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...
0
9901
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9751
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10682
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10371
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9513
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5743
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3187
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.