首页 > 代码库 > JS获取页面上所有input

JS获取页面上所有input

1   for (var i = 0; i < document.getElementsByTagName("input").length; i++) {2             if (document.getElementsByTagName("input")[i].id.indexOf("tx_ID") > -1) {3                 document.getElementById("hid_SetValue").value += document.getElementsByTagName("input")[i].id + "," + document.getElementsByTagName("input")[i].value + "|";4             }5         }
获取所有Input
 1  function GetAllIframeItem() { 2         document.getElementById("hid_LogInfo").valuehttp://www.mamicode.com/= ""; 3         var a = document.getElementById("Iframe3").contentWindow; 4         var all = ""; 5         var mytds =a.document.getElementsByTagName("td"); 6         for (var i = 0; i < a.document.getElementsByTagName("td").length; i++) { 7             document.getElementById("hid_LogInfo").value += a.document.getElementsByTagName("td")[i].innerText + ","; 8         } 9         alert(document.getElementById("hid_LogInfo").value);10         return false;11     }
获取iFrame的所有 

 

JS获取页面上所有input