473,320 Members | 1,916 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,320 software developers and data experts.

Nested Anchors


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 searched words
are inside <a href> tags, the links are lost after putting my anchors.
For example:

<a class="Programa" href="#" OnClick="window.open('/something.tif');"
<a name="LPHit1"/><font style='color:blue; background-color:yellow;'>SOME</font>TH<a name="LPHit2"/><font
style='color:blue; background-color:yellow;'>ING</font></a>

Anchors 'LPHit' are used to navigate between the searched words inside
the html page. The list of anchors 'LPHitXXX' are recovered by calling
the document.anchors.

I wouldn´t like to change my algorithm too much, so I was wondering
if it is possible to create another kind of tag, for example 'b' and
replace the above as following:

<a class="Programa" href="#" OnClick="window.open('/something.tif');"<b name="LPHit1"/><font style='color:blue;

background-color:yellow;'>SOME</font>TH<b name="LPHit2"/><font
style='color:blue; background-color:yellow;'>ING</font></a>

And I need to be able to get the list of 'b' anchors 'LPHitXXX', by
calling some custom method: document.banchors;

Is it possible? Or else is there another idea to deal with nested
anchors?
Best regards

Jul 23 '05 #1
1 2006
ml*****@terra.com.br wrote:
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 searched words
are inside <a href> tags, the links are lost after putting my anchors.
For example:

<a class="Programa" href="#" OnClick="window.open('/something.tif');"
<a name="LPHit1"/><font style='color:blue;


background-color:yellow;'>SOME</font>TH<a name="LPHit2"/><font
style='color:blue; background-color:yellow;'>ING</font></a>

Anchors 'LPHit' are used to navigate between the searched words inside
the html page. The list of anchors 'LPHitXXX' are recovered by calling
the document.anchors.

I wouldn´t like to change my algorithm too much, so I was wondering
if it is possible to create another kind of tag, for example 'b' and
replace the above as following:

<a class="Programa" href="#" OnClick="window.open('/something.tif');"
<b name="LPHit1"/><font style='color:blue;


background-color:yellow;'>SOME</font>TH<b name="LPHit2"/><font
style='color:blue; background-color:yellow;'>ING</font></a>

And I need to be able to get the list of 'b' anchors 'LPHitXXX', by
calling some custom method: document.banchors;

Is it possible? Or else is there another idea to deal with nested
anchors?


Why are you nesting <a> elements? Just have one after the other. They
surely are seperate links to seperate pages?

You can't create your own tags. You can assign tags a class (as you have
done), then retreive all elements of a certain tag name, and filter them
on the className attribute to arrive at just the ones you want. See the
getElementsByTagName() method of HTML elements.

See http://www.w3.org/TR/DOM-Level-2-Cor...t-binding.html

and spefically for HTML documents,
http://www.w3.org/TR/DOM-Level-2-HTM...t-binding.html

Jul 23 '05 #2

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...
2
by: learner | last post by:
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...
12
by: seajays | last post by:
I've got my page working just as I wanted it - but when I came to validate the XHTML, using W3c's validator it failed. Essentially as far as I can see it the problem is this: 1: <div> 2: <a...
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...
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.