如何對瀏覽器進行判斷,並設制標籤屬性

$(document).ready(function(){
  
  if(navigator.appName=='Netscape'){
     if(window.navigator.userAgent.toLowerCase().indexOf("firefox")>0){
               
       $("body").css("margin-top","30");
       $("body").css("margin-left","30");
       $("#ConsoleLogFormat").css("width","250");
          $("#ConsoleLogFormat").css("height","20");
          $("#fileName").css("width","250");
          $("#fileName").css("height","20");
          $("#fileSize").css("width","55");
          $("#fileSize").css("height","20");
          $("#fileFormat").css("width","250");
          $("#fileFormat").css("height","20");
          $("#logLevel").css("width","157");
          $("#logLevel").css("height","20");
       }
       else{
                $("body").css("margin-top","30");
       $("body").css("margin-left","30");
       $("#ConsoleLogFormat").css("width","240");
          $("#ConsoleLogFormat").css("height","20");
          $("#fileName").css("width","240");
          $("#fileName").css("height","20");
          $("#fileSize").css("width","50");
          $("#fileSize").css("height","20");
          $("#fileFormat").css("width","240");
          $("#fileFormat").css("height","20");
          $("#logLevel").css("width","150");
          $("#logLevel").css("height","20");
             
       }
       
  }
 
     
});

此方法就是設置谷歌,火狐的 不同id的css樣式

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章