JavaScript语法问题我无法解决[已关闭]

46qrfjad  于 2023-01-11  发布在  Java
关注(0)|答案(1)|浏览(114)

这个问题不太可能帮助任何未来的访问者;它只与一个小的地理区域、一个特定的时刻或一个非常狭窄的情况有关,而这些情况通常不适用于Internet的全球用户。要帮助更广泛地应用此问题,请访问visit the help center
9年前关闭。

function ActiveTab()
   {   
   var a= $find("ctl00_ContentPlaceHolder1_tcEmployee_ClientState").value;
    alert("First line");
    var add=document.getElementById("ctl00_ContentPlaceHolder1_btnAddRecord");
        alert("after add");
     var update=document.getElementById("ctl00_ContentPlaceHolder1_btnUpdateRecord"); 
        alert("after update");
      var delet= document.getElementById("ctl00_ContentPlaceHolder1_DeleteRecord");
            alert("after del");
        if(a == 0)
        { 
                alert("if 0");  
            add.WebForm_PostBackOptions = "Insertion";
            update.WebForm_PostBackOptions = "Insertion";
            delet.WebForm_PostBackOptions = "Insertion";
        } 
        else if(a == 1)
        {
            alert("if 1");
            add.WebForm_PostBackOptions = "Insertion1";
            update.WebForm_PostBackOptions = "Insertion1";
            delet.WebForm_PostBackOptions = "Insertion1"; 
        }
        else  
        {
                alert("else");
            add.WebForm_PostBackOptions = "Insertion2";
            update.WebForm_PostBackOptions = "Insertion2";
            delet.WebForm_PostBackOptions= "Insertion2";   
        }  
  }

我的代码有什么问题我收到};丢失错误。我的代码有什么问题?

5hcedyr0

5hcedyr01#

应为getElementById

var add = document.setElementById("ctl00_ContentPlaceHolder1_btnAddRecord");

以及缺失的=

var delet document.getElementById("ctl00_ContentPlaceHolder1_DeleteRecord");

相关问题