日期:2014-05-16  浏览次数:20382 次

JS根据屏幕分辨率自动调整字体大小
window.onload=font;
function font(){
   if (screen.width <1024)
       document.styleSheets[0].addRule("body","font-size:12px;");
   else if (screen.width ==1024)
         document.styleSheets[0].addRule("body","font-size:14px;");
      else if (screen.width >1024)
           document.styleSheets[0].addRule("body","font-size:16px;");
         else
             document.styleSheets[0].addRule("body","font-size:16px;");
}