473,242 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

Anchors!

Hi,

A document has many Anchors.
I want to take a particular action only if some particular anchors
are clicked.
I mean if some anchors are clicked, i want an alert box to pop up
with ok and cancel. and if ok is clicked i have to view that link, if
cancel, then it should not open that link.
How to do this?

Jul 23 '05 #1
2 1865

"learner" <v_********@yahoo.com> wrote in message
news:cg********@odah37.prod.google.com...
Hi,

A document has many Anchors.
I want to take a particular action only if some particular anchors
are clicked.
I mean if some anchors are clicked, i want an alert box to pop up
with ok and cancel. and if ok is clicked i have to view that link, if
cancel, then it should not open that link.
How to do this?


HTML doesn't pop up alert boxes. That's a Javascript question, for a
Javascript newsgroup.

Jul 23 '05 #2
In article <cg********@odah37.prod.google.com>,
"learner" <v_********@yahoo.com> wrote:
A document has many Anchors.
I want to take a particular action only if some particular anchors
are clicked.
I mean if some anchors are clicked, i want an alert box to pop up
with ok and cancel. and if ok is clicked i have to view that link, if
cancel, then it should not open that link.
How to do this?

A JavaScript-only solution:
<a href="http://www.google.com/"
onclick="return confirm('Are you sure
you want to follow this link?');">

This will only work for people with JavaScript enabled.
A non-JavaScript solution is to refer to a server side script that
checks if the URl needs intervention (characteristics of the URL, a
database or some other argument [1]) and will either cause an immediate
redirect to that URL or pause and ask for the visitor's confirmation.

Something like:
<a href="redirect.php?url=www.google.com">

[1] Passing more arguments, to tell the script to intervene for this
particular URL:
<a href="redirect.php?stop=true&amp;url=www.google.co m">
A crossbreed solution of these two suggestions is also possible by
having the JavaScript interrupt the browser from following the link,
evaluating if the link needs a confirmation, ask for it and redirect to
the URL that gets extracted from the href attribute.
Another solution, in case you are looking for some kind of disclaimer
system, is to state upfront that links that are marked a certain way are
'special', 'adult', or whatever, and are to be treated with user
discretion. Then mark those links, for instance by adding an icon or
textual comment to them.

--
Kris
<kr*******@xs4all.netherlands> (nl)
Jul 23 '05 #3

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

Similar topics

7
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a...
1
by: Peter Jakobi | last post by:
Hello, I want to place two lines relative to another. The problem is, that these two lines are in different groups. Is there an possibility to set the x and y values of the second line with...
2
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
1
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
12
by: Rich | last post by:
Strangely, on-page anchors will work on MSIE, but not on Netscape7.2 or Firefox1.5. All anchors are numbers e.g. <a href="#21">TOPIC</a> supposed to connect down to <a name="#21>beginning of...
17
by: Crimperman | last post by:
Hi, need some advice on URIs In a dynamic page (perl driven) we list a number of items presented in an hierarchical tree structure. Within that page is a form which allows you to search for...
1
by: Alec MacLean | last post by:
Hi. I'm using VS2005 Pro to work on a website project for my company. The site has several navigation elements, all based on the standard VS2005 navigation components. I have high-level...
3
by: windandwaves | last post by:
does it matter if I write var anchors = document.getElementsByTagName("A"); or var anchors = document.getElementsByTagName("a"); Or is there a better way to catch both <a hrefs and <A...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.