SoFunction
Updated on 2025-04-03

Detailed analysis of javascript traversal control instance


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN/TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml" >
<head>
<title>JS traversal control to get value</title>
    <mce:script type="text/javascript"><!--
    function Submit()
    {
       var Text=("input");
      var Array="";
        for(var i=0;i<;i++)
        {
            if(Text[i].type=="text"||Text[i].type=="checkbox")
            {
              Array+=",";
              Array+=Text[i].value;
            }

        }
         Array=(1,);
         alert(Array);
    }

// --></mce:script>
</head>
<body>
    <table>
        <tr>
            <td style="width: 100px">
<input type="checkbox" value="Huguo" />Huguo</td>
            <td style="width: 100px">
                <input type="text" value="ws_hgo" /></td>
            <td style="width: 100px">
                <input type="button" value="button" onclick="Submit(this)" /></td>
        </tr>
         </table>

</body>
</html>