18-01-2012, 15:26
(Ten post był ostatnio modyfikowany: 18-01-2012, 15:27 przez Kartofelek.)
Kod:
function kliknieto() {
var linki = document.getElementsByTagName('a');
for (var i=0; i<linki.length; i++) {
if (this == linki[i]) {
alert(i);
}
}
}
costam.onclick = kliknieto;
tutaj też masz inne techniki:
http://forums.htmlhelp.com/index.php?showtopic=746
Ogólnie sporo jest na ten temat w google -> javascript return index element