我正在嘗試遍歷getElementsByTagName("input")使用forEach 重構的所有元素。有什么想法為什么在FF,Chrome或IE中不起作用?<html> <head> </head> <body> <input type="text" value="" /> <input type="text" value="" /> <script> function ShowResults(value, index, ar) { alert(index); } var input = document.getElementsByTagName("input"); alert(input.length); input.forEach(ShowResults); </script> </body></html>
請問如何遍歷從getElementsByTagName返回的所有元素
森林海
2020-01-05 11:00:03