andrisp Posted July 4, 2005 Report Posted July 4, 2005 piemeeram, ir +blabla1 +blabla2 +blabla3 +blabla4 iedodiet luudzu taadu simple piemeeru izmantojot javascriptu, kaa var panaatk lai, piemeeram, nospiezhot uz 'blabla2' paraadiitos kautkaa shitaa +blabla1 -blabla2 - ta taa - ti tii - tu tuu +blabla3 +blabla4 un protams arii reversi - pazuud ja nospiezh otreiz.. vislabaakais buutu ja izmantotu html listes paliidzeesiet?
andrisp Posted July 4, 2005 Author Report Posted July 4, 2005 display:none/block switchoshana 19001[/snapback] taa jau sapratu, tipa man vajag ar onClick paliidziibu izsaukt javascriptu, kas piemeeram uztaisa display: block, un arii preteeji.. bet kaa to tiiri tehniski izdariit ?
Delfins Posted July 4, 2005 Report Posted July 4, 2005 taa jau sapratu,tipa man vajag ar onClick paliidziibu izsaukt javascriptu, kas piemeeram uztaisa display: block, un arii preteeji.. bet kaa to tiiri tehniski izdariit ? 19002[/snapback] bļāviens, tev jau takš pateica...
andrisp Posted July 4, 2005 Author Report Posted July 4, 2005 nu taadaa gadijumaa iebakstiet man to sejaa, sauciet mani par iditiotu-liikroci, bet nu nesapratu kaa..
bubu Posted July 4, 2005 Report Posted July 4, 2005 Vienlīmeņa meņu. Iekš #tree elementā katra li itema jābūt vienam <a> elementam un vienam <ul> elementam. <html> <head> <script type="text/javascript"> function toggle(evt) { var el = null; // IE un FF atšķirības if (!evt && window.event) evt = window.event; if (evt.target) { el = (evt.target.nodeType == 3) ? evt.target.parentNode : evt.target; } else { el = evt.srcElement; } // var ul = el.parentNode.getElementsByTagName('ul'); if (ul.length>0) { ul[0].style.display = (ul[0].style.display=='none' ? '' : 'none'); } } window.onload = function() { var tree = document.getElementById('tree'); for (var i=0, len=tree.childNodes.length; i<len; i++) { var node = tree.childNodes[i]; if (node.nodeName.toLowerCase()=='li') { var a = node.getElementsByTagName('a'); if (a.length>0) a[0].onclick = toggle; var ul = node.getElementsByTagName('ul'); if (ul.length>0) ul[0].style.display = 'none'; } } } </script> </head><body> <ul id="tree"> <li><a href="#">Folder1</a> <ul> <li><a href="#">1.1</a></li> <li><a href="#">1.2</a></li> <li><a href="#">1.3</a></li> </ul> </li> <li><a href="#">Folder2</a> <ul> <li><a href="#">2.1</a></li> <li><a href="#">2.2</a></li> </ul> </li> </body></html>
andrisp Posted July 4, 2005 Author Report Posted July 4, 2005 paldies bubu, preciizi tas kas vajadziigs
Recommended Posts