你说的+号是: onnodeclick:function(item){.....},你打开那个tree.js文件,看看这个事件是怎么写的,然后你照写一个,比如: onnodetextclick:function(item){}
下边是节点点击的事件,我没时间去看它的代码,暂时就发给你,你增加一个文本点击的事件
$.fn.treeview = function(settings) {
var dfop =
{
method: "POST",
datatype: "json",
/**
* @description {Config} url
* {String} Url for child nodes retrieving.
*/
url: false,
/**
* @description {Config} cbiconpath
* {String} Checkbox image path.
*/
cbiconpath: "./css/images/icons/",
icons: ["checkbox_0.gif", "checkbox_1.gif", "checkbox_2.gif"],
/**
* @description {Config} showcheck
* {Boolean} Whether to show check box or not.
*/
showcheck: false,
/**
* @description {Event} oncheckboxclick:function(tree, item, status)
* Fired when check box is clicked on.
* @param {Object} tree This tree object.
* @param {Object} item Node item clicked on.
* @param {Number} status 1 for checked, 0 for unchecked.
*/
oncheckboxclick: false,
/**
* @description {Event} onnodeclick:function(tree, item)
* Fired when a node is clicked on.
* @param {Object} tree This tree object.
* @param {Object} item Ndde item clicked on.
*/
onnodeclick: false,
/**
* @description {Config} cascadecheck
* {Boolean} Whether node being seleted leads to parent/sub node being selected.
*/
cascadecheck: true,
/**
* @description {Config} data
* {Object} Tree theme. Three themes provided. 'bbit-tree-lines' ,'bbit-tree-no-lines' and 'bbit-tree-arrows'.
* @sample
* data:[{
* id:"node1", //node id
* text:"node 1", //node text for display.
* value:"1", //node value
* showcheck:false, //whether to show checkbox
* checkstate:0, //Checkbox checking state. 0 for unchecked, 1 for partial checked, 2 for checked.
* hasChildren:true, //If hasChildren and complete set to true, and ChildNodes is empty, tree will request server to get sub node.
* isexpand:false, //Expand or collapse.
* complete:false, //See hasChildren.
* ChildNodes:[] // child nodes
* }]
* */
data: null,
/**
* @description {Config} clicktoggle
* {String} Whether to toggle node when node clicked.
*/
clicktoggle: true,
/**
* @description {Config} theme
* {String} Tree theme. Three themes provided. 'bbit-tree-lines' ,'bbit-tree-no-lines' and 'bbit-tree-arrows'.
*/
theme: "bbit-tree-arrows" //bbit-tree-lines ,bbit-tree-no-lines,bbit-tree-arrows
};
function nodeclick(e) {
var path = $(this).attr("tpath");
var et = e.target || e.srcElement;
var item = getItem(path);
if (et.tagName == "IMG") {
//+ if collapsed, expend it
if ($(et).hasClass("bbit-tree-elbow-plus") || $(et).hasClass("bbit-tree-elbow-end-plus")) {
var ul = $(this).next(); //"bbit-tree-node-ct"
if (ul.hasClass("bbit-tree-node-ct")) {
ul.show();
}
else {
var deep = path.split(".").length;
if (item.complete) {
item.ChildNodes != null && asnybuild(item.ChildNodes, deep, path, ul, item);
}
else {
$(this).addClass("bbit-tree-node-loading");
asnyloadc(item, true, function(data) {
item.complete = true;
item.ChildNodes = data;
asnybuild(data, deep, path, ul, item);
});
}
}
if ($(et).hasClass("bbit-tree-elbow-plus")) {
$(et).swapClass("bbit-tree-elbow-plus", "bbit-tree-elbow-minus");
}
else {
$(et).swapClass("bbit-tree-elbow-end-plus", "bbit-tree-elbow-end-minus");
}
if(dfop.theme!="bbit-tree-lines-no-folder")
$(this).swapClass("bbit-tree-node-collapsed", "bbit-tree-node-expanded");
}
//if expended, collapse it
else if ($(et).hasClass("bbit-tree-elbow-minus") || $(et).hasClass("bbit-tree-elbow-end-minus")) {
$(this).next().hide();
if ($(et).hasClass("bbit-tree-elbow-minus")) {
$(et).swapClass("bbit-tree-elbow-minus", "bbit-tree-elbow-plus");
}
else {
$(et).swapClass("bbit-tree-elbow-end-minus", "bbit-tree-elbow-end-plus");
}
if(dfop.theme!="bbit-tree-lines-no-folder")
$(this).swapClass("bbit-tree-node-expanded", "bbit-tree-node-collapsed");
}
else if ($(et).hasClass("bbit-tree-node-cb")) // click on checkbox
{
var s = item.checkstate != 1 ? 1 : 0;
var r = true;
if (dfop.oncheckboxclick) {
r = dfop.oncheckboxclick.call(et, item, s);
}
if (r != false) {
if (dfop.cascadecheck) {
cascade(check, item, s);
bubble(check, item, s);
}
else {
check(item, s, 1);
}
}
}
}
else {
if (dfop.citem) {
var nid = dfop.citem.id.replace(/[^\w]/gi, "_");
$("#" + id + "_" + nid).removeClass("bbit-tree-selected");
}
dfop.citem = item;
$(this).addClass("bbit-tree-selected");
if (dfop.onnodeclick) {
if (!item.expand) {
item.expand = function() { expandnode.call(item); };
}
dfop.onnodeclick.call(this, item);
}
}
}
if rs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write ""
response.write "下一页 尾页"