js 循环控件

  var controls = document.getElementById("tbsell").getElementsByTagName('input');

                                for (var i = 0; i < controls.length; i++) {
                                    if (controls[i].type == 'text') {
                                        controls[i].value = brr[i];
                                    }
                                }

  <table class="table_noborder_fontleft" id="tbsell" style=" border:0px;">
                            <tr>
                                <td>
                                    <input type="text" maxlength="10" id="sellpro1" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro2" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro3" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro4" style="width: 68px;" />
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" maxlength="10" id="sellpro5" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro6" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro6" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro7" style="width: 68px;" />
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" maxlength="10" id="sellpro8" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro9" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro10" style="width: 68px;" />
                                    &nbsp;
                                    <input type="text" maxlength="10" id="sellpro11" style="width: 68px;" />
                                    &nbsp;
                                </td>
                            </tr>
                        </table>

posted @ 2009-10-22 20:48  ggbbeyou  阅读(401)  评论(0编辑  收藏  举报