$(document).ready(function(){ $("#header_bide").load("modules/header.html?t=2021" + Math.random()); $("#footer_bide").load("modules/footer.html?t=2021" + Math.random()); }) //获取产品主图 function _getProimg(cas,pid){ var filedomainname="https://file.bidepharm.com"; var foldername=Math.ceil(parseInt(pid.substring(1))/1000);//该产品图片存放的文件夹名称 var img=''; if(!isempty(cas)&&cas!="N/A"){ img=cas+".png"; }else{ img=pid+".png"; } return filedomainname+"/static/upload/proimg/"+foldername+"/"+img; } //获取产品url function _getProUrl(cas, pid) { var url = "javascript:;"; if (!isempty(cas) && cas != "N/A") { url = "https://www.bidepharm.com/products/" + cas + '.html' } else if (!isempty(pid)) { url = "https://www.bidepharm.com/products/" + pid + '.html' } return url } function isempty(v){ switch (typeof v) { case undefined : return true; case 'undefined' : return true; case 'string' : if(v.Trim().length == 0||v.Trim()=='undefined') return true; break; case 'boolean' : if(!v) return true; break; case 'number' : if(0 === v) return true; break; case 'object' : if(null === v) return true; if(undefined !== v.length && v.length==0) return true; for(var k in v){return false;} return true; break; } return false; } String.prototype.Trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); }