具有相同 ID 和名称的两个 HTML 输入动态求解

Two HTML inputs with same Id and Name solve dynamically

如您所见,我想要两个或多个带有 samo Id 和名称的输入,但 HTML 不允许这样做,那么我如何通过其他方式解决这个问题以及如何激活按钮改变它的颜色

<table border="0" cellspacing="0" cellpadding = "0" style="font-size:x-small">        
            <tr valign="bottom" style="height:10px">
               <td width="30px" style="vertical-align: top">
                </td>
                <td width="30px" style="vertical-align: middle" align="center" nowrap="nowrap">
                    <label style="font-size:small">
                        Time period</label>

                    <input type="hidden" id="ReportParameter" value = "1" name="ReportParameter" />       
                    <input class="button" id="showDailyReport" name="searchQueue" type="submit" value="Day" onClick="onClickHandler(this)" />

                    <input type="hidden" id="ReportParameter" value = "2" name="ReportParameter"/>       
                    <input class="button" id="showWeeklyReport" name="searchQueue" type="submit" value="Week" onClick="onClickHandler(this)" />

                </td>
            </tr>

        </table>

您可以为每个按钮定义特定的 class 并对其进行视觉更改 class 前

<input class="button button-red" id="showDailyReport" name="searchQueue" type="submit" value="Day" onClick="onClickHandler(this)" />