海外醫療產品地址轉換
阿新 • • 發佈:2017-07-07
his 更改 html cts each each循環 else if 地址轉換 attr
主要是通過js將地址的前綴改為醫療國家的網址,然後通過each循環更改每個網址
具體代碼如下:
var o=$(".pro_listbox").find(".pro_listbox"); o.each(function(){ var tmp=$(this).find("img").attr("src").split("/"); var h=$(this).find("a").attr("href").split("/"); var m=tmp[tmp.length-3]; if(m=="preservation"){ $(this).find("a").attr("href","/ph/business_products/medical/preservation/"+h[h.length-1].replace("html","shtml")); }else if(m=="who_pqs_certificated_equipment"){ $(this).find("a").attr("href","/ph/business_products/medical/who_pqs_certificated_equipment/"+h[h.length-1].replace("html","shtml")); }else if(m=="bio_safety_cabinet"){ $(this).find("a").attr("href","/ph/business_products/medical/bio_safety_cabinet/"+h[h.length-1].replace("html","shtml")); } });
海外醫療產品地址轉換