/* * 基于jQuery下拉树形插件 $Author:hongjun.hu $Date: 2014-04-30 */ (function($) { $.fn.hmtree = function(settings) { // 默认参数 var p = { height : "auto", mustSelect : false, showcheck : false }; $.extend(p, settings); var l = $(this); processAjaxTree(); function processAjaxTree() { var treedata = []; $.ajaxSetup({ cache : false }); $.ajax({ url : "getTreeData.htm", data : { "lx" : p.lx }, method : "post", dataType : "json", success : function(result) { for (var i = 0; i < result.length; i++) { treedata.push(result[i]); } $(l).treebuild({ url : "getTreeData.htm", data : treedata, showcheck : false, onnodeclick : function(item) { var hrefStr = p.hrefURL; if (p.lx == "行政区划") { hrefStr += "?qhbm=" + item.value + "&qhlx=" + item.qhlx; } huimv.loadPage("xzqhRight", hrefStr); }, asnyParam : [{ name : "lx", value : p.lx }] }); } }); } return l; }; })(jQuery);