2012-02-04 2 views
0

파이어 버그에서이 코드를 검사하면 전체 블록이 비활성화됩니다.전체 스크립트 블록이 비활성화되는 이유는 무엇입니까?

<script type="text/javascript"> 

var usercount = 0; 
var nbw = ''; 
$(document).ready(function() { 
    $('.alphabet').each(function() { 
     _$this = $(this); 
     nbw = $(this).val(); 
     $.ajax({ 
      type: "Get", 
      url: "cfc/basic.cfc?method=CountUsersByLetter&returnformat=json", 
      data: "nbw=" + nbw, 
      datatype: "html", 
      success: function (response) { 
       usercount = parseInt(response.substring(0, 10)); 
       $(_$this.target).attr('title', usercount); 
      }, 
      error: function (xhr, textStatus, errorThrown) { 
       alert('errorThrown'); 
      } 
     }); 
    }); 
    $('.StartOver').live('click', function() { 
     var ReInitAnswer = confirm('Are you sure you want TO DELETE ALL temp dupe records AND start over FROM SCRATCH? \nIt may take a couple OF hours.'); 
     if (ReInitAnswer) { 
      // submit the form TO BEGIN re-creating the temp table 
      document.forms["dupeIndivs"].submit(); 
      //return true; 
     } ELSE { 
      alert('canceled'); 
      return false; 
     } 
    }); 
    $('.notdupe').live('click', function (e) { 
     alert("indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked")); 
     $.ajax({ 
      type: "POST", 
      url: "cfc/basic.cfc?method=SetNotDupe", 
      data: "indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"), 
      error: function (xhr, textStatus, errorThrown) { 
       // show error alert(errorThrown); 
      } 
     }); 
    }); 
    $('.alphabet').live('click', function (l) { 
     SelectedLetter = $(l.target).val(); 
     $(".alphabet").each(function (i) { 
      var CheckLetter = $(this).val(); 
      if (CheckLetter == SelectedLetter) { 
       $(this).css("background-color", "yellow"); 
       $('.NameBeginsWith').val(SelectedLetter); 
      } ELSE { 
       $(this).css("background-color", ""); 
      } 
     }); 
     $('.Reinit').attr('value', SelectedLetter); 
     $('.Reinit').trigger('click'); 
    }); 

</script> 
+0

는 "장애인"이란 무엇을 의미합니까? –

+0

각 줄 앞에 4 개의 공백을 붙여야합니다. 블록 그 자체는 빈 줄로 시작해야합니다. –

답변

1
  • 당신은 (자바 스크립트는 대소 문자를 구분) else 모든 대문자 ELSE를 교체해야합니다.
  • 코드 끝에 닫기 중괄호와 괄호를 추가하여 $(document).ready(function(){ 블록을 완료하십시오.

근무 코드 :

<script type="text/javascript"> 

    var usercount = 0; 
    var nbw = ''; 
    $(document).ready(function() { 
     $('.alphabet').each(function() { 
      _$this = $(this); 
      nbw = $(this).val(); 
      $.ajax({ 
       type: "Get", 
       url: "cfc/basic.cfc?method=CountUsersByLetter&returnformat=json", 
       data: "nbw=" + nbw, 
       datatype: "html", 
       success: function (response) { 
        usercount = parseInt(response.substring(0, 10)); 
        $(_$this.target).attr('title', usercount); 
       }, 
       error: function (xhr, textStatus, errorThrown) { 
        alert('errorThrown'); 
       } 
      }); 
     }); 
     $('.StartOver').live('click', function() { 
      var ReInitAnswer = confirm('Are you sure you want TO DELETE ALL temp dupe records AND start over FROM SCRATCH? \nIt may take a couple OF hours.'); 
      if (ReInitAnswer) { 
       // submit the form TO BEGIN re-creating the temp table 
       document.forms["dupeIndivs"].submit(); 
       //return true; 
      } else { // <------------------------------------ ELSE > else 
       alert('canceled'); 
       return false; 
      } 
     }); 
     $('.notdupe').live('click', function (e) { 
      alert("indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked")); 
      $.ajax({ 
       type: "POST", 
       url: "cfc/basic.cfc?method=SetNotDupe", 
       data: "indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"), 
       error: function (xhr, textStatus, errorThrown) { 
        // show error alert(errorThrown); 
       } 
      }); 
     }); 
     $('.alphabet').live('click', function (l) { 
      SelectedLetter = $(l.target).val(); 
      $(".alphabet").each(function (i) { 
       var CheckLetter = $(this).val(); 
       if (CheckLetter == SelectedLetter) { 
        $(this).css("background-color", "yellow"); 
        $('.NameBeginsWith').val(SelectedLetter); 
       } else { // <------------------------------------ ELSE > else 
        $(this).css("background-color", ""); 
       } 
      }); 
      $('.Reinit').attr('value', SelectedLetter); 
      $('.Reinit').trigger('click'); 
     }); 
    }); // <---------------------------------------------------- Added }); 
</script> 
+0

그게 전부입니다. 방금 알아 냈어. eclipse에서 "형식 소스"도구를 사용하면 ELSE가 제공됩니다. 그들이 그렇게 할 것이라는 것이 매우 이상합니다. 다시 한번, 많은 감사합니다. 나는 출구에 문을 닫을거야. 누군가가 Chris Kempen에게 그가 문제의 일부분이 아니라 솔루션의 일부라고 말할 필요가 있습니다. – user990016

관련 문제