Hello comrades! Happy you! Such is the task, I'll start from the beginning:

There is the most common HTML document that contains two tags:


A script is written that will, without reloading the page, show the desired one instead of the one we see (fixing it through Ajax ). Each page will have a name, javascript code, and the body of the page. Actually the question is: how to track if the label already in the HTML document


There may be several of them and they may contain different code. However, if a person loads the same page several times, the same code will be added between


but do not need to do this. Is it possible to track this? Is it possible to numbered them somehow, put them in an array for tracking?

  • strange idea you have is to use tags. I would obviously have developed ajax navigation in a different way - kandi
  • Perhaps we misunderstood each other, by tags I meant the notion of tag (HTML tag). - Andrey Arshinov

1 answer 1

If I got it right. Assign a unique id, namely:

 <script id="foo"> 

And while loading the next page, check availability and ...

  • Yes, you understood everything correctly. But does the standard allow adding to <script> sv - in id? - Andrey Arshinov
  • For me, the first priority is validity, which, unfortunately, sometimes disagrees with W3C standards. If it smells of mothballs (for example, IE6) responds normally, then I think this is a valid decision. For example, using JQuery tooltip or FancyBox plugins implies placement in the alt and title attributes of the layout (html entities), and nothing. As for the assignment of id to the <script> tag, I had to resort to this when I used CMS with modules that were bundled with JS. - romeo
  • By the way, [Giving the script tag an ID] [1] [1]: stackoverflow.com/questions/2741441/giving-the-script-tag-an-id - romeo
  • Well, thank you! - Andrey Arshinov