Good all the time of day, gentlemen.
Yesterday, armed with this - got the following:
// вывожу в php ссылки, которые отдают данные ajax скрипту <a style=\"{cursor:pointer;display:inline;}\" id=\"si_aa".$m4["id"]."\" onclick="getElem(this);"> <div style=\"display:inline; padding:1px; border-radius:3px;\"> Слово </div> </a>
Below on the same page I write the following
<script> function getElem(elem) { var elems = elem.getElementsByTagName('div'); var first_el = elems[0]; if(first_el.getAttribute('active') == undefined || first_el.getAttribute('active') == '0') { first_el.style.backgroundColor = '#99DDFF'; first_el.setAttribute('active', '1'); } else { first_el.style.backgroundColor = 'FFFFFF'; first_el.setAttribute('active', '0'); } } </script>
It turns out such an analogue checkbox, and blue highlighted links are clicked, which if desired, and more can be squeezed.
Is it possible to do this so that with a certain number of clicked links, it will be impossible to click on more links, and all non-clicked links will replace id with 0? (Although you can not replace the id.)
Let's say a person clicked on some of these links, as soon as 3 is marked, all other links cannot be clicked (ideally, they will have 0 id) until you press one back. Tell me, is it possible?