2013-09-23 111 views
0

在這個jquery函數中,我想啓用瀏覽按鈕,但我無法做到這一點。 按鈕ID是ctl00_ContentPlaceHolder1_fupSendNewDocument啓用Jquery瀏覽按鈕。

<script language="javascript" type="text/javascript"> 
    function pageLoad() { 
    $(function() { 

    /********************************************Open and close model window for File Upload*********************************/ 

    $('#divAttach').click(
     function() { 

     var filedivcount = $('div').filter('#MultiFilelabel1').length; 

     var $btn = $('#divAttach'); 

     var count = ($btn.data("click_count") || 0) + 1; 

     $btn.data("click_count", count); 

     $("#ctl00_ContentPlaceHolder1_fupSendNewDocument").attr("disabled", false); 


     if ($('input').filter('#ctl00_ContentPlaceHolder1_fupSendNewDocument_F1').length > 0) { 
      if (count < 3 || filedivcount < 3) { 
      document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument_F1').click(); 
      } else { 
      alert('you can upload only 3 files'); 
      } 


     } 

     if ($('input').filter('#ctl00_ContentPlaceHolder1_fupSendNewDocument_F4').length > 0) { 
      if (count < 3 || filedivcount < 3) { 
      document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument_F4').click(); 
      } else { 
      alert('you can upload only 3 files'); 
      } 


     } else { 

      if (count < 3 || filedivcount < 3) { 
      document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument').click(); 
      } else { 
      alert('you can upload only 3 files'); 
      } 

     } 
     } 
    ); 
    }); 
} 
    </script> 
+0

不要使用編號:s通過web表單生成。這不可靠。 – Johan

+0

旁註:一旦你開始使用jQuery,不要問'document'關於'getElementById'顯式:) – madfriend

回答