Home > Article > Web Front-end > JavaScript client traversing controls and obtaining parent container object sample code_javascript skills
1, traverse all the controls in the surface
function findControlAll()
{
var inputs=document.getElementsByTagName("input");
for(j=0;j
{
inputs [j]. Value = "" "; // Clear the content of the text box
}
}
2 , traverse the controls in the specified container
function findControl()
{
// table1 below refers to traversing the controls in the table
var inputs = document.getElementById( "table1").getElementsByTagName("input");
for(var i=0;i
if(inputs[i].type=="text" )//Same as above, the type of control and the operations to be done can be filled in as needed
🎜>
Get the parent container object
Copy code