jsp页面用jquery.treeView点击父节点文本d出子节点怎么弄啊

jsp页面用jquery.treeView点击父节点文本d出子节点怎么弄啊,第1张

你说的+号是: onnodeclick:function(item){},你打开那个treejs文件,看看这个事件是怎么写的,然后你照写一个,比如: onnodetextclick:function(item){}

下边是节点点击的事件,我没时间去看它的代码,暂时就发给你,你增加一个文本点击的事件

$fntreeview = 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_0gif", "checkbox_1gif", "checkbox_2gif"],

/

@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 = etarget || esrcElement;

var item = getItem(path);

if (ettagName == "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 (ulhasClass("bbit-tree-node-ct")) {

ulshow();

}

else {

var deep = pathsplit("")length;

if (itemcomplete) {

itemChildNodes != null && asnybuild(itemChildNodes, deep, path, ul, item);

}

else {

$(this)addClass("bbit-tree-node-loading");

asnyloadc(item, true, function(data) {

itemcomplete = true;

itemChildNodes = 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(dfoptheme!="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(dfoptheme!="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 = itemcheckstate != 1 1 : 0;

var r = true;

if (dfoponcheckboxclick) {

r = dfoponcheckboxclickcall(et, item, s);

}

if (r != false) {

if (dfopcascadecheck) {

cascade(check, item, s);

bubble(check, item, s);

}

else {

check(item, s, 1);

}

}

}

}

else {

if (dfopcitem) {

var nid = dfopcitemidreplace(/[^\w]/gi, "_");

$("#" + id + "_" + nid)removeClass("bbit-tree-selected");

}

dfopcitem = item;

$(this)addClass("bbit-tree-selected");

if (dfoponnodeclick) {

if (!itemexpand) {

itemexpand = function() { expandnodecall(item); };

}

dfoponnodeclickcall(this, item);

}

}

}

$(function(){

$("input_bt")click(function(){

var text=$("input_text")val();//获取标签文字

var the_li='<li><a href=\"#\">'+text+'</a></li>';//插入标签

$("content li")each(function fun(){//判断是否重复

txt=$(this)text();

if(text==txt){

alert("该内容已添加");

return false;

}

})

if(txt!=text){如果不重复则添加

$("content")append(the_li);

}

})

})<div style="">

<input type="text" value="" class="input_text" /><input type="button" value="点击添加" class="input_bt"  /> <span>尝试添加一个重复的内容</span>

<div class="menu"><h1 class="title">我是标题</h1>

    <ul class="content">

    <li><a href="#">选项一</a></li>

    <li><a href="#">选项二</a></li>

    <li><a href="#">选项三</a></li>

    <li><a href="#">选项四</a></li>

    <li><a href="#">选项五</a></li>

    </ul>

</div>

</div>

</div>

这个是jquery的 需要先加载jquery插件

内部插入:1,append;2,appendTo;3,prepend;4,prependTo

外部插入:1,after;2,before;3,insertAfter;4,insertBefore

具体的怎么用你可以再百度下

小伙子,不要太老实

先获取dom中三种语言,删除三个<li>,再与另三种语言组成数组,排好序之后,再forEach或者map方法组装成<li><span>XXX</span></li>,最后再插入到<ul>中,是不是简单些

$("div")//选取div

$("div>p")//选取div的子元素p

jQuery 选择器大全

$("#myELement")    选择id值等于myElement的元素,id值不能重复在文档中只能有一个id值是myElement所以得到的是唯一的元素 

$("div")           选择所有的div标签元素,返回div元素数组 

$("myClass")      选择使用myClass类的css的所有元素 

$("")             选择文档中的所有的元素,可以运用多种的选择方式进行联合选择:例如$("#myELement,div,myclass") 

 

层叠选择器: 

$("form input")         选择所有的form元素中的input元素 

$("#main > ")          选择id值为main的所有的子元素 

$("label + input")     选择所有的label元素的下一个input元素节点,经测试选择器返回的是label标签后面直接跟一个input标签的所有input标签元素 

$("#prev ~ div")       同胞选择器,该选择器返回的为id为prev的标签元素的所有的属于同一个父元素的div标签 

 

基本过滤选择器: 

$("tr:first")               选择所有tr元素的第一个 

$("tr:last")                选择所有tr元素的最后一个 

$("input:not(:checked) + span")   

 

过滤掉:checked的选择器的所有的input元素 

 

$("tr:even")               选择所有的tr元素的第0,2,4 个元素(注意:因为所选择的多个元素时为数组,所以序号是从0开始) 

 

$("tr:odd")                选择所有的tr元素的第1,3,5 个元素 

$("td:eq(2)")             选择所有的td元素中序号为2的那个td元素 

$("td:gt(4)")             选择td元素中序号大于4的所有td元素 

$("td:ll(4)")              选择td元素中序号小于4的所有的td元素 

$(":header") 

$("div:animated") 

内容过滤选择器: 

 

$("div:contains('John')") 选择所有div中含有John文本的元素 

$("td:empty")           选择所有的为空(也不包括文本节点)的td元素的数组 

$("div:has(p)")        选择所有含有p标签的div元素 

$("td:parent")          选择所有的以td为父节点的元素数组 

可视化过滤选择器: 

 

$("div:hidden")        选择所有的被hidden的div元素 

$("div:visible")        选择所有的可视化的div元素 

属性过滤选择器: 

 

$("div[id]")              选择所有含有id属性的div元素 

$("input[name='newsletter']")    选择所有的name属性等于'newsletter'的input元素 

 

$("input[name!='newsletter']") 选择所有的name属性不等于'newsletter'的input元素 

 

$("input[name^='news']")         选择所有的name属性以'news'开头的input元素 

$("input[name$='news']")         选择所有的name属性以'news'结尾的input元素 

$("input[name='man']")          选择所有的name属性包含'news'的input元素 

 

$("input[id][name$='man']")    可以使用多个属性进行联合选择,该选择器是得到所有的含有id属性并且那么属性以man结尾的元素 

 

子元素过滤选择器: 

 

$("ul li:nth-child(2)"),$("ul li:nth-child(odd)"),$("ul li:nth-child(3n + 1)") 

 

$("div span:first-child")          返回所有的div元素的第一个子节点的数组 

$("div span:last-child")           返回所有的div元素的最后一个节点的数组 

$("div button:only-child")       返回所有的div中只有唯一一个子节点的所有子节点的数组 

 

表单元素选择器: 

 

$(":input")                  选择所有的表单输入元素,包括input, textarea, select 和 button 

 

$(":text")                     选择所有的text input元素 

$(":password")           选择所有的password input元素 

$(":radio")                   选择所有的radio input元素 

$(":checkbox")            选择所有的checkbox input元素 

$(":submit")               选择所有的submit input元素 

$(":image")                 选择所有的image input元素 

$(":reset")                   选择所有的reset input元素 

$(":button")                选择所有的button input元素 

$(":file")                     选择所有的file input元素 

$(":hidden")               选择所有类型为hidden的input元素或表单的隐藏域 

 

表单元素过滤选择器: 

 

$(":enabled")             选择所有的可 *** 作的表单元素 

$(":disabled")            选择所有的不可 *** 作的表单元素 

$(":checked")            选择所有的被checked的表单元素 

$("select option:selected") 选择所有的select 的子元素中被selected的元素 

 

  

 

选取一个 name 为”S_03_22″的input text框的上一个td的text值

$(”input[@ name =S_03_22]“)parent()prev()text() 

 

名字以”S_”开始,并且不是以”_R”结尾的

$(”input[@ name ^='S_']“)not(”[@ name $='_R']“) 

 

一个名为 radio_01的radio所选的值

$(”input[@ name =radio_01][@checked]“)val(); 

 

  

 

  

 

$("A B") 查找A元素下面的所有子节点,包括非直接子节点

$("A>B") 查找A元素下面的直接子节点

$("A+B") 查找A元素后面的兄弟节点,包括非直接子节点

$("A~B") 查找A元素后面的兄弟节点,不包括非直接子节点 

 

1 $("A B") 查找A元素下面的所有子节点,包括非直接子节点 

 

例子:找到表单中所有的 input 元素 

 

HTML 代码: 

 

<form>

<label>Name:</label>

<input name="name" />

<fieldset>

      <label>Newsletter:</label>

      <input name="newsletter" />

</fieldset>

</form>

<input name="none" /> 

jQuery 代码: 

 

$("form input") 

结果: 

 

[ <input name="name" />, <input name="newsletter" /> ] 

 

2 $("A>B") 查找A元素下面的直接子节点 

例子:匹配表单中所有的子级input元素。 

 

HTML 代码: 

 

<form>

<label>Name:</label>

<input name="name" />

<fieldset>

      <label>Newsletter:</label>

      <input name="newsletter" />

</fieldset>

</form>

<input name="none" /> 

jQuery 代码: 

 

$("form > input") 

结果: 

 

[ <input name="name" /> ] 

 

3 $("A+B") 查找A元素后面的兄弟节点,包括非直接子节点 

例子:匹配所有跟在 label 后面的 input 元素 

 

HTML 代码: 

 

<form>

<label>Name:</label>

<input name="name" />

<fieldset>

      <label>Newsletter:</label>

      <input name="newsletter" />

</fieldset>

</form>

<input name="none" /> 

jQuery 代码: 

 

$("label + input") 

结果: 

 

[ <input name="name" />, <input name="newsletter" /> ] 

 

 

4 $("A~B") 查找A元素后面的兄弟节点,不包括非直接子节点 

例子:找到所有与表单同辈的 input 元素 

 

HTML 代码: 

 

<form>

<label>Name:</label>

<input name="name" />

<fieldset>

      <label>Newsletter:</label>

      <input name="newsletter" />

</fieldset>

</form>

<input name="none" /> 

jQuery 代码: 

 

$("form ~ input") 

结果: 

 

[ <input name="none" /> ]

以上就是关于jsp页面用jquery.treeView点击父节点文本d出子节点怎么弄啊全部的内容,包括:jsp页面用jquery.treeView点击父节点文本d出子节点怎么弄啊、jquery增加节点的时候判断增加的内容是否重复、jQuery中插入节点的方法有哪些等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9544334.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存