<script type="text/javascript"> function getElementsByClassName (className) { var all = document.getElementsByTagName('*'); var elements = new Array(); for (var e = 0; e < all.length; e++) { if (all[e].className == className) { elements[elements.length] = all[e]; break; } } return elements; }
window.onload = function(){ var watch = document.getElementById('watchmore'); var op = document.getElementsByTagName('p').getElementsByClassName('none'); watch.onlick = function(){ if(watch.innerHTML == "显示"){ for(var i=0; i<op.length; i++){ op[i].style.display = "block"; watch.innerHTML = "隐藏"; } } else { for(var i=0; i<op.length; i++){ op[i].style.diaplay = "none"; watch.innerHTMl = "查看更多"; } } } }
</script>
为什么当我点击那个按钮的时候,提示document.getElementsByTagName(...).getElementsByClassName is not a function
添加回答
举报
0/150
提交
取消