created a link with id (when initially loading the page, it runs php and inserts it via a variable, and when you continue to stay on the page, you need js to change the real data of url and title by timer):
<a id="linkid" target="_blank" href="http://site.com/<?= $link->url?>"><?= $link->name?></a> here is the script:
var a = document.createElement('a'); var name = 'сюда я получаю имя ссылки по таймеру'; var linkText = document.createTextNode(name); a.appendChild(linkText); a.target = '_blank'; a.href = "http://site.com/" + name; var link = document.getElementById('linkid'); link.setAttribute('href', a); link.setAttribute('title', name); document.getElementById("linkid").href = a.href; document.getElementById("linkid").title = name; The fact is that the url of the link changes on a timer, as it should be, but the title is not