Qued Posted May 19, 2005 Report Share Posted May 19, 2005 Lieta tāda: iekš div'a ir čupa ar <a bla bla bla>, kuriem visiem vajag piesaistīt vienu un to pašu funkciju showTgLink(). To daru tā: var tg=document.getElementById('phon_lett'); //tas ir tas div's for(i=tg.all.length-1;i>=0;i--) { if (tg.all(i).tagName == 'a' || tg.all(i).tagName == 'A') { tg.all(i).onmouseover=showTgLink; } } Uz Operas un IE strādā. Uz FF nestrādā, jo jams nepazīst tādu "all". Kā apiet šo problēmu? Jau iepriekš pateicos. Link to comment Share on other sites More sharing options...
bubu Posted May 19, 2005 Report Share Posted May 19, 2005 (edited) var tags=document.getElementById('phon_lett').getElementsByTagName('a'); if (window.addEventListener) { for (var i=tags.length-1; i>=0; --i) tags[i].addEventListener('mouseover', showTgLink, true); } else if (window.attachEvent){ for (var i=tags.length-1; i>=0; --i) tags[i].attachEvent('onmouseover', showTgLink); } Edited May 19, 2005 by bubu Link to comment Share on other sites More sharing options...
Qued Posted May 19, 2005 Author Report Share Posted May 19, 2005 Tnx a lot :) getElementsByTagName :) Link to comment Share on other sites More sharing options...
bubu Posted May 19, 2005 Report Share Posted May 19, 2005 Ja daudz JavaSkriptosi, tad skati te: http://www.mozilla.org/docs/dom/domref/dom_el_ref.html Tur labas lietas var atrast :) Link to comment Share on other sites More sharing options...
Recommended Posts