<div class="codetitle"> <span><a style="CURSOR: pointer" data="35497" class="copybut" id="copybut35497" onclick="doCopy('code35497')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code35497"> <br>function getElementsByClassName(n) { <br>var classElements = [], allElements = document.getElementsByTagName('*'); <br>for (var i=0; i{ <br>if (allElements[i].className == n ) { <br>classElements[classElements.length] = allElements[ 나]; <br>} <br>} <br>classElements를 반환합니다. <br>} <br> </div>