Sasa Posted January 8, 2009 Report Share Posted January 8, 2009 (edited) Kā lai taisa, ja man ir vienā kolonnā events kas izdotu paziņojumu par to kurā rindā (rindas index pēc kārtas) ir tikusi nospiesta pele. Tik ko lai paliek zem tā eventa, lai viss strādā? labots: Atvainojos, uzdevu jautājumu nemaz neko nemeklējot :| Edited January 8, 2009 by Sasa Link to comment Share on other sites More sharing options...
Grey_Wolf Posted January 8, 2009 Report Share Posted January 8, 2009 (rindas index pēc kārtas) Pat neko mekleet nevajag Jo atbilde ir ietverta tava pasa jautajumaa ? Jebshu nemaki skaitiit ?? Link to comment Share on other sites More sharing options...
Sasa Posted January 9, 2009 Author Report Share Posted January 9, 2009 Kēpēc tā ka es rowindex varu dabūt tikai pēc <tr> taga? Link to comment Share on other sites More sharing options...
bubu Posted January 9, 2009 Report Share Posted January 9, 2009 Kas kāpēc? Nesapratu tavu jautājumu. Link to comment Share on other sites More sharing options...
Sasa Posted January 9, 2009 Author Report Share Posted January 9, 2009 (edited) man nesanāk sataisīt, tā lai ja uzklikšķina iekš šis kolonnas uz 'F' izvadītos rindas index, kurā tas tika noklikšķināts. <td id="detalasNr" class="detalasNr">'+(num)+'<SUP id="figdet" class="figdet"> F</SUP></td> mans kods: if (!document.getElementsByTagName || !document.createTextNode) return; var rows = document.getElementById('details').getElementsByTagName('tbody')[0].getElementsByTagName('tr'); for (i = 0; i < rows.length; i++) { rows[i].getElementsByTagName("sup").onclick = function() { alert(this.rowIndex + 1); } } Edited January 9, 2009 by Sasa Link to comment Share on other sites More sharing options...
bubu Posted January 9, 2009 Report Share Posted January 9, 2009 function alerter(index) { alert(index); } if (!document.getElementsByTagName || !document.createTextNode) return; var rows = document.getElementById('details').getElementsByTagName('tbody')[0].getElementsByTagName('tr'); for (i = 0; i < rows.length; i++) { rows[i].getElementsByTagName("sup").onclick = function() { alerter(i + 1); } } Link to comment Share on other sites More sharing options...
indoom Posted January 12, 2009 Report Share Posted January 12, 2009 (edited) Uz arraya jau nevar likt onclick eventu. Nav jau jquery objekts. Un arī, ja liec uz to sup to rowIndex, tad izmanto parentNode (vai ko citu) līdz tr un nolasi rowIndex no tā. Iekš funkcijas this būs tas elements, uz kura uzlikts onclick, respektīvi, tas sup. Tātad this.parentNode.parentNode.rowIndex (sup -> td -> tr) Edited January 12, 2009 by indoom Link to comment Share on other sites More sharing options...
v3rb0 Posted January 12, 2009 Report Share Posted January 12, 2009 un vēl aiz for cikla pieraksti i=-1; ij redzēsi ka closuri tur vajag. Link to comment Share on other sites More sharing options...
Recommended Posts