我正在尝试使用 switch 语句switch (buttionId)
,传入我选择的按钮的 id,但是,该函数没有正确触发。这是我的功能:
function PickDiagCode(btnNum, button) {
var txtID;
var strId;
//var buttonId = $("input[id*=btnHeaderDiagPick]").attr("id");
switch (button.value) {
case "Clear":
switch (button.id) {
case "btnHeaderDiagPick1":
//Do Work
case "btnHeaderDiagPick2":
//Do Work
以下是按钮:
<input class="Button-Search" id="btnHeaderDiagPick1" onclick="document.frmCrgEntry.hdnPickClrDiagCode.value='1';PickDiagCode('1',btnHeaderDiagPick1);"
type="button" name="btnHeaderDiagPick1" runat="server" />
<input class="Button-Search" id="btnHeaderDiagPick2" onclick="document.frmCrgEntry.hdnPickClrDiagCode.value='2';PickDiagCode(2,btnHeaderDiagPick2);"
type="button" name="btnHeaderDiagPick2" runat="server" />