<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> <br>function getElementsByClassName(n) { <br> allElements = document.getElementsByTagName('*'); <br>for (var i=0; i{ <br>if (allElements[i].className == n ) { <br>classElements[classElements.length] = allElements[我]; <br>} <br>} <br>回傳類別元素; </div>}