A
A
altair_u2015-10-09 19:40:02
JavaScript
altair_u, 2015-10-09 19:40:02

How to use javascript to determine the item's item that was clicked?

for example there is a code like this

<ul>
    <li>
    <li><a href="#">0</a></li>
    <li><a href="#">1</a></li>
    <li><a href="#">n</a></li>
</ul>

aa=document.getElementsByTagName("a");

function pla()
{
    var i=aa.iteam();// вот тут и проблема  не знаю как мне определить индекс текущего нажатого ссылка.
    return alert(i);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-10-09
@altair_u

jsfiddle.net/g44d74dh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question