2012-06-01 54 views
3

我已經編寫了一段代碼,並且所有值都爲零。它不會將零視爲數字並將其發送到其他條件。所以驗證失敗了。我附上了下面的代碼。所有非零數字都被接受,但是當我在文本框中寫入零時,它會根據我的驗證說「請輸入一個數字」。ExCanvas無法在IE7和IE8中工作IFrame

$('.scoreTextInput').change(function(){ 
      $(this).each(function(){ 
       var errorId=$(this).attr('bind'); 
       if(Number($(this).val())) 
       { 
        if(($(this).val())>100) 
        { 
        $('#'+errorId).text('Score must not exceed 100%'); 
        $(this).val(0); 
        } 
        else{ 
         $('#'+errorId).text(''); 

        } 
       } 
        else 
        { 
        $('#'+errorId).text('Please enter a number'); 
        $(this).val(0); 
        } 
       }); 

回答