The following functions realize the control ID of all HTML control types in the page
Copy code code as follows:
Function Texts ()
{{
// var els = document.GetelementsBytagname ("*"); // Els get all controls on the page
var els = document.GetelementsBytagname ("input"); // also above, so as to reduce the cycle
var msgs = "";
for (var I = 0; I <els.Length; i ++)
{{
if (els [i] .Type == "Text")
{{
// Get the control ID
msgs + = els [i] .id + ",";;
}
}
alert (msgs);
}