1 <script> 2 var requestObj=(function(){ 3 var url=window.location.href; 4 var str_key_val = url.substr(url.indexOf("?")); //获取url中"?"符后的字串 5 var theRequest = new Object(); 6 if (str_key_val.indexOf("?") != -1) { 7 var str = str_key_val.substr(1); 8 strs = str.split("&"); 9 for(var i = 0; i < strs.length; i ++) { 10 theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]); 11 } 12 } 13 return theRequest; 14 }()); 15 function setRemFontSize(baseSize,baseWidth){ 16 //基本 字体大小 17 var baseSize = baseSize||100; 18 //设计图的基本宽度750 iphone6尺寸 (640*118比例) 19 var baseWidth = baseWidth||640; 20 var clientWidth = document.documentElement.clientWidth>=480?480:document.documentElement.clientWidth; 21 clientWidth = document.documentElement.clientWidth<=320?320:document.documentElement.clientWidth; 22 document.getElementsByTagName('html')[0].style.fontSize = clientWidth*baseSize/baseWidth+'px' 23 } 24 setRemFontSize(); 25 window.addEventListener("resize",function(){ 26 setTimeout(function(){setRemFontSize();},200) 27 }); 28 </script>