<script type="text/javascript"> function find_c1() { var f1 = document.getElementById('layer').getElementsByClassName('c1') for (var i=0; i<f1.length; i++) alert(i); } </script>