Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Sor beillesztése
- document.getElementById('ListTable').innerHTML = '<tr><td><a href="#"><strong>-</strong></a><span>Cella 1.1</span></td><td><a href="#"><strong>-</strong></a><span>Cella 1.2</span></td><td><a href="#"><strong>-</strong></a><span>Cella 1.3</span></td></tr>';
- //Sor hozzáadása
- document.getElementById('ListTable').innerHTML += '<tr><td><a href="#"><strong>-</strong></a><span>Cella 1.1</span></td><td><a href="#"><strong>-</strong></a><span>Cella 1.2</span></td><td><a href="#"><strong>-</strong></a><span>Cella 1.3</span></td></tr>';
- //Sor cseréje
- document.getElementById('ListTable').getElementsByTagName('tr')[1].innerHTML = '<td><a href="#"><strong>-</strong></a><span>Cella 2.1</span></td><td><a href="#"><strong>-</strong></a><span>Cella 2.2</span></td><td><a href="#"><strong>-</strong></a><span>Cella 2.3</span></td>';
- //A cellákat rejtő linkek megkeresése
- cellarejto = document.getElementById('ListTable').getElementsByTagName('a');
- for (i=0; i<cellarejto.length; i++) {
- //Ha rákattintunk a linkre
- cellarejto[i].onclick = function() {
- //Elrejtés
- if ((this.nextSibling.style.display=='inline') || (this.nextSibling.style.display=='')) {
- this.innerHTML = '+';
- this.nextSibling.style.display='none';
- //Megmutatás
- } else {
- this.innerHTML = '-';
- this.nextSibling.style.display='inline';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment