(function(){ fangjia = new Object(); fangjia.gujiaBox = { appKey : '', // api用户appKey elId : '', size : 'simple', // big:950x120 simple:950x80 cityName : '上海', // 城市名 regionName : '', // 区域名 totalPriceStart : 0, // 总价start totalPriceEnd : 0, // 总价end room : 0, // 户型(室数) keyword : '', // 关键词 init : function(){ var _this = fangjia.gujiaBox; var _el = document.getElementById(_this.elId); /** * json序列化 */ var serializeJson = function(o){ if(typeof o != 'object'){ return o; } var ret = []; for (var key in o) { if(typeof o[key] == 'function'){ continue; } if(o[key] != null && typeof o[key] == 'object' && o[key].length>0){ for ( var i = 0; i < o[key].length; i++) { if(typeof o[key][i] == 'string' || typeof o[key][i] == 'number'){ ret.push(key); ret.push('='); ret.push(o[key][i]); ret.push('&'); } } }else if(o[key] != null){ ret.push(key); ret.push('='); ret.push(o[key]); ret.push('&'); } } if(ret.length>0){ ret[ret.length-1] = ''; } return ret.join(''); }; if (_this.elId && _el) { var _width = 950; var _height = 80; if ('simple' == _this.size) { _width = 950; _height = 80; } else if ('big' == _this.size) { _width = 950; _height = 120; } var _html = []; _html.push('') _html.push(''); _html.push(''); _el.innerHTML = _html.join(''); } else { alert('请指定fangjia.gujiaBox.elId.若有疑问,请联系我们.'); } } }; })()