1 function kbmjRecommend(type, query, charset, target_id) {
2 var host = "recommend.kbmj.com";
3 if(!navigator.userAgent.match(/Mozilla\/4\.0 \(compatible; MSIE 5\.\d*; (Windows|MSN|AOL)/)){
9 var q = query == "" ? "" : query + "&";
10 var url = location.protocol + "//" + host + "/recommend/" + type + "/?" + q + "target_id=" + target_id + "&charset=" + charset;
12 var func = function(){
13 var script = document.createElement('script');
14 script.setAttribute('type', 'text/javascript');
15 script.setAttribute('charset', charset);
16 script.setAttribute('src', url);
17 var target = document.getElementById(target_id);
18 target.appendChild(script);
21 if(window.addEventListener){
22 window.addEventListener('load', func, false);
23 }else if(window.attachEvent){
24 window.attachEvent('onload', func);