开发者

JavaScript syntax issue I cannot resolve [closed]

开发者 https://www.devze.com 2023-03-05 21:41 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.
   function ActiveTab()
   {   
   var a= $find("ctl00_ContentPlaceHolder1_tcEmployee_ClientState").value;
    alert("First line开发者_StackOverflow中文版");
    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";   
        }  
  }

What is problem with my code I receive } and ; missing error. What is wrong with my code?


should be getElementById:

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

and missing =:

var delet document.getElementById("ctl00_ContentPlaceHolder1_DeleteRecord");
0

精彩评论

暂无评论...
验证码 换一张
取 消