sasasasa
http://blog.csdn.net/chenleixing/article/details/45241939
http://blog.csdn.net/chengxuyuan20100425/article/details/8497277
http://blog.csdn.net/jackiehff/article/details/8582449
http://shinestarwang.iteye.com/blog/800550
http://blog.csdn.net/c622724/article/details/8486909
http://www.cnblogs.com/supperwu/archive/2012/06/13/2548122.html
http://blog.sina.com.cn/s/blog_59a9112f0100yxzr.html
http://www.cnblogs.com/hnrainll/archive/2011/10/11/2206804.html
http://blog.csdn.net/aaa1117a8w5s6d/article/details/7838007
http://www.w3school.com.cn/jsref/jsref_encodeuri.asp
http://blog.csdn.net/indieinside/article/details/7618863
http://www.cnblogs.com/dolphin0520/p/3920357.html
http://www.cnblogs.com/fish-li/archive/2011/07/17/2108884.html
http://blog.csdn.net/mad1989/article/details/26389541
http://www.cnblogs.com/A_ming/archive/2010/04/13/1711395.html
http://blog.csdn.net/leehong2005/article/details/8623374
http://developer.51cto.com/art/200908/141825.htm
http://lavasoft.blog.51cto.com/62575/38588/
http://zhouyq.iteye.com/blog/240910
indexOf
http://hhhk.iteye.com/blog/2082860
http://blog.csdn.net/xymyeah/article/details/2665840
/*public static String getWeekFirst(int year, int week){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.set(year, 0, 1);
int weeks = 0;
while((weeks = calendar.get(Calendar.WEEK_OF_YEAR))<= week){
calendar.add(Calendar.MONTH, 1);
System.out.println(calendar.get(Calendar.WEEK_OF_YEAR));
}
calendar.add(Calendar.MONTH, -1);
System.out.println(calendar.get(Calendar.WEEK_OF_YEAR));
while((weeks = calendar.get(Calendar.WEEK_OF_YEAR))< week){
calendar.add(Calendar.DATE, 1);
}
Date timec = calendar.getTime();
String xtime = sdf.format(timec);
return xtime;
}*/
/* public static String getWeekFirst(int year,int weekCount){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
//设置calendar的日期,此处可以确定某一天
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.WEEK_OF_YEAR, weekCount-1);
calendar.set(Calendar.DAY_OF_WEEK, 0);
//获取该天的信息(理论而言,通过改变get函数的参数,可以获取该天的任意信息)
int day = calendar.get(Calendar.DAY_OF_YEAR);
int[] days=new int[7];
for(int i=0;i<7;i++){
days[i] = calendar.get(Calendar.DAY_OF_MONTH);
System.out.print((calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DAY_OF_MONTH)+"日 ");
day++;
calendar.set(Calendar.DAY_OF_YEAR, day);
}
Date timec = calendar.getTime();
String xtime = sdf.format(timec);
return xtime;
}*/
public static String getWeekFirst(int year,int weekCount){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String xtime = "";
Calendar startdate = Calendar.getInstance();
startdate.set(Calendar.YEAR, year);
startdate.set(Calendar.WEEK_OF_YEAR, weekCount-1);
startdate.set(Calendar.DAY_OF_WEEK, 0);
int startday = startdate.get(Calendar.DAY_OF_YEAR);
startdate.set(Calendar.DAY_OF_YEAR, startday);
Date times = startdate.getTime();
String start = sdf.format(times);
Calendar enddate = Calendar.getInstance();
enddate.set(Calendar.YEAR, year);
enddate.set(Calendar.WEEK_OF_YEAR, weekCount-1);
enddate.set(Calendar.DAY_OF_WEEK, 0);
int endday = enddate.get(Calendar.DAY_OF_YEAR)+6;
enddate.set(Calendar.DAY_OF_YEAR, endday);
Date timee = enddate.getTime();
String end = sdf.format(timee);
xtime = start +";"+ end;
return xtime;
}
向上
WITH RECURSIVE r AS (
SELECT * FROM acu_customercircle
WHERE circleunitid = 'd05c24fa-dc32-4357-8a48-0f72efdfd85a' union ALL SELECT acu_customercircle.* FROM acu_customercircle,
r WHERE acu_customercircle.circleunitid = r.guidparentid)
SELECT * FROM r ORDER BY circleunitid;
向下
WITH RECURSIVE T (circleunitid, strname, guidparentid, dwgrade) AS (
SELECT circleunitid, strname, guidparentid, dwgrade
FROM acu_customercircle
WHERE circleunitid = '712a9d32-e7d9-41d7-b07f-42a2e8c4a827'
UNION ALL
SELECT D.circleunitid, D.strname, D.guidparentid, D.dwgrade
FROM acu_customercircle D
JOIN T ON D.guidparentid = T.circleunitid)
SELECT circleunitid, strname, guidparentid, dwgrade FROM T
ORDER BY dwgrade;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
// 全选
$("#btnCheckAll").bind("click", function () {
$("[name = chkItem]:checkbox").attr("checked", true);
});
// 全不选
$("#btnCheckNone").bind("click", function () {
$("[name = chkItem]:checkbox").attr("checked", false);
});
// 反选
$("#btnCheckReverse").bind("click", function () {
$("[name = chkItem]:checkbox").each(function () {
$(this).attr("checked", !$(this).attr("checked"));
});
});
// 全不选
$("#btnSubmit").bind("click", function () {
var result = new Array();
$("[name = chkItem]:checkbox").each(function () {
if ($(this).is(":checked")) {
result.push($(this).attr("value"));
}
});
alert(result.join(","));
});
});
</script>
</head>
<body>
<div>
<input name="chkItem" type="checkbox" value="今日话题" />今日话题
<input name="chkItem" type="checkbox" value="视觉焦点" />视觉焦点
<input name="chkItem" type="checkbox" value="财经" />财经
<input name="chkItem" type="checkbox" value="汽车" />汽车
<input name="chkItem" type="checkbox" value="科技" />科技
<input name="chkItem" type="checkbox" value="房产" />房产
<input name="chkItem" type="checkbox" value="旅游" />旅游
</div>
<div>
<input id="btnCheckAll" type="button" value="全选" />
<input id="btnCheckNone" type="button" value="全不选" />
<input id="btnCheckReverse" type="button" value="反选" />
<input id="btnSubmit" type="button" value="提交" />
</div>
</body>
</html>
在Ztree的官网Demo中,有自动展开的例子,是通过设置节点属性open:true来实现自动展开的,但是在异步加载中,这个属性设置为true也不会自动展开,因为open:true是指在有子节点的情况下展开,在异步加载之前,当前节点是没有子节点的,所以无法打开。
异步加载自动展开解决方法如下:
1.设置ztree的加载完成的回调函数:
setting = {
......
callback: {
......
onAsyncSuccess: zTreeOnAsyncSuccess
}
};
onAsyncSuccess是指加载完成后要调用的方法,其他节点的设置请参考ztree的官网Demo.
2.编写方法zTreeOnAsyncSuccess
var firstAsyncSuccessFlag = 0;
function zTreeOnAsyncSuccess(event, treeId, msg) {
if (firstAsyncSuccessFlag == 0) {
try {
//调用默认展开第一个结点
var selectedNode = zTree.getSelectedNodes();
var nodes = zTree.getNodes();
zTree.expandNode(nodes[0], true);
var childNodes = zTree.transformToArray(nodes[0]);
zTree.expandNode(childNodes[1], true);
zTree.selectNode(childNodes[1]);
var childNodes1 = zTree.transformToArray(childNodes[1]);
zTree.checkNode(childNodes1[1], true, true);
firstAsyncSuccessFlag = 1;
} catch (err) {
}
}
}
此方法可以自动加载第一级节点,try{} catch()是为了捕获节点不存在时的异常,这样可以使其不跑出js错误信息。
firstAsyncSuccessFlag变量的作用是使tree只在页面初始化后自动展开一次,因为手动点击加号展开子节点的时候也会调用此方法,通过此变量来标识是否自动加载。
function zTreeOnAsyncSuccess(event, treeId, treeNode, msg){
var treeObj = $.fn.zTree.getZTreeObj(treeId);
var node = treeObj.getNodeByParam("isParent", true, null);
treeObj.expandNode(node,true,false,true,true);
var nodes = treeObj.getNodeByParam("isParent", true, node);
if(nodes.length>0){
for(var i=0;i<nodes.length;i++){
treeObj.expandNode(nodes[i],true,false,true,true);
}
}
treeObj.selectNode(node.children[0]);
}
$(_self).on("blur",function(event){
if($.dropdown._isClose) $.dropdown.close();
event.stopPropagation();
return false;
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>分页</title>
<script type="text/javascript" src="jquery-1.2.5.js"></script>
<style>
.page { margin:20px; }
.page a {
margin:0 5px;
padding:1px 3px;
display:inline-block;
border:1px solid #000;
}
</style>
</head>
<body>
<div id="bbb">
111111111111111111111111111111111
<div class="fpage"> </div>
222222222222222222222222222222222
<div class="fpage"> </div>
333333333333333333333333333333333
<div class="fpage"> </div>
444444444444444444444444444444444
</div>
<script type="text/javascript">
var $ = function(id){
return document.getElementById(id);
};
var str = $('bbb').innerHTML.toLowerCase();
var ie = !+[1,];
var arr = ie ? str.split('<div class=fpage> </div>') : str.split('<div class="fpage"> </div>');
$('bbb').innerHTML = arr[0];
var page = document.createElement('div');
page.className = 'page';
var tmp = '';
for(var i = 1, len = arr.length; i <= len; i++){
tmp += '<a href="javascript:test('+(i-1)+');">'+i+'</a>';
}
page.innerHTML = tmp;
document.body.appendChild(page);
function test(i){
$('bbb').innerHTML = arr[i];
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js 判断鼠标位置让div消失</title>
<style type="text/css">
<!--
body{margin:0px;padding:0px;}
-->
</style>
<script>
function c()
{
document.getElementById('h_div').style.display = "";
return false;
}
function d()
{
//alert(window.event.clientX);
//alert(window.event.clientY);
var wx = window.event.clientX;
var wy = window.event.clientY;
var d_left = document.getElementById('h_div').offsetLeft;
var d_top = document.getElementById('h_div').offsetTop;
var d_width = document.getElementById('h_div').clientWidth;
var d_height = document.getElementById('h_div').clientHeight;
//alert(wx + '_' + wy + '_' + d_left + '_' + d_width + '_' + d_top + '_' + d_height)
if(wx < d_left || wy < d_top || wx > (d_left + d_width) || wy > (d_top + d_height))
document.getElementById('h_div').style.display = "none";
return false;
}
</script>
</head>
<body onClick="javascript:d();" >
<div onMouseOver="javascript:c();" style="width:150px;height:30px;margin:auto;margin-left:200px;border:1px solid red;position:relative;">
Click me
</div>
<div id="h_div" style="display:none;position:absolute;margin-top:0px;margin-left:200px;width:150px;height:100px;border:1px solid green;font-size:12px;">
<input type="checkbox" id="aa" name="aa" title=""/><label for="aa">第一个</label><br />
<input type="checkbox" id="bb" name="bb" title=""/><label for="bb">第二个</label><br />
<input type="checkbox" id="cc" name="cc" title=""/><label for="cc">第三个</label><br />
<input type="checkbox" id="dd" name="dd" title=""/><label for="dd">第四个</label><br />
<input type="checkbox" id="ee" name="ee" title=""/><label for="ee">第五个</label><br />
</div>
</body>
</html>
<html>
<head>
<title> tb </title>
<script>
window.onload = function(){
var tbl = document.getElementById("tb");
for(var i = 0; i < tbl.rows.length; i++){
tbl.rows[i].cells[0].innerText = "ddddddd";//自动在每行第一个单元格内填入内容
if(i % 2 == 0){//偶数行背景色为红色
tbl.rows[i].style.backgroundColor = 'red';
}//基数行背景色为蓝色
else tbl.rows[i].style.backgroundColor = "blue";
}
}
</script>
</head>
<body`>
<table width="500" border= "1" id= "tb">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
package test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class week {
public static void main(String[] args) {
List<Usa> list1 = new ArrayList<Usa>();
list1.add(new Usa("1","name1"));
list1.add(new Usa("2","name2"));
list1.add(new Usa("3","name3"));
List<Usa> list2 = new ArrayList<Usa>();
list2.add(new Usa("1","name1"));
list2.add(new Usa("2","name3"));
list2.add(new Usa("3","name3"));
list2.add(new Usa("4","name4"));
List<Usa> res = theDiffOfList(list1,list2,true);
StringBuffer sb = new StringBuffer();
for(Usa u : res){
sb.append(u.getId() + "-" + u.getName() + ";");
}
System.out.println("insert:"+sb);
List<Usa> res2 = theDiffOfList(list1,list2,false);
sb = new StringBuffer();
for(Usa u : res2){
sb.append(u.getId() + "-" + u.getName() + ";");
}
System.out.println("del:"+ sb);
}
private static List<Usa> theDiffOfList(List<Usa> a,List<Usa> b,Boolean isAdd){
List<Usa> diff = new ArrayList<Usa>();
List<Usa> tmpa = new ArrayList<Usa>(Arrays.asList(new Usa[a.size()]));
Collections.copy(tmpa, a);
List<Usa> tmpb = new ArrayList<Usa>(Arrays.asList(new Usa[b.size()]));
Collections.copy(tmpb, b);
if(isAdd){
tmpa.removeAll(tmpb);
for(Usa u : tmpa){
diff.add(u);
}
}else{
tmpb.removeAll(tmpa);
for(Usa u : tmpb){
diff.add(u);
}
}
return diff;
}
}
class Usa{
private String id ;
private String name;
public Usa(String id, String name) {
super();
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Usa other = (Usa) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
SELECT AA,BB FROM AAAA MINUS SELECT AA,BB ,CC FROM CC
create table CCCC(
AA varchar2(2) not null,
BB varchar2(10),
cc varchar2(10)
)
--比较两个表的数据是否一致--
select AA,BB from AAAA a where NOT exists(select AA,BB from BBBB b where a.AA= b.AA and a.BB=b.BB)
select AA,BB from BBBB a where NOT exists(select AA,BB from AAAA b where a.AA= b.AA and a.BB=b.BB)
select * from BBBB a where NOT exists(select * from AAAA b where a.AA= b.AA and a.BB=b.BB)
select * from BBBB
SELECT * FROM AAAA
1. 在执行速度方面的比较:StringBuilder > StringBuffer
2. StringBuffer与StringBuilder,他们是字符串变量,是可改变的对象,每当我们用它们对字符串做操作时,实际上是在一个对象上操作的,不像String一样创建一些对象进行操作,所以速度就快了。
3. StringBuilder:线程非安全的
StringBuffer:线程安全的
当我们在字符串缓冲去被多个线程使用是,JVM不能保证StringBuilder的操作是安全的,虽然他的速度最快,但是可以保证StringBuffer是可以正确操作的。当然大多数情况下就是我们是在单线程下进行的操作,所以大多数情况下是建议用StringBuilder而不用StringBuffer的,就是速度的原因。
对于三者使用的总结:1.如果要操作少量的数据用 = String
2.单线程操作字符串缓冲区 下操作大量数据 = StringBuilder
3.多线程操作字符串缓冲区 下操作大量数据 = StringBuffer
http://blog.csdn.net/chengxuyuan20100425/article/details/8497277
http://blog.csdn.net/jackiehff/article/details/8582449
http://shinestarwang.iteye.com/blog/800550
http://blog.csdn.net/c622724/article/details/8486909
http://www.cnblogs.com/supperwu/archive/2012/06/13/2548122.html
http://blog.sina.com.cn/s/blog_59a9112f0100yxzr.html
http://www.cnblogs.com/hnrainll/archive/2011/10/11/2206804.html
http://blog.csdn.net/aaa1117a8w5s6d/article/details/7838007
http://www.w3school.com.cn/jsref/jsref_encodeuri.asp
http://blog.csdn.net/indieinside/article/details/7618863
http://www.cnblogs.com/dolphin0520/p/3920357.html
http://www.cnblogs.com/fish-li/archive/2011/07/17/2108884.html
http://blog.csdn.net/mad1989/article/details/26389541
http://www.cnblogs.com/A_ming/archive/2010/04/13/1711395.html
http://blog.csdn.net/leehong2005/article/details/8623374
http://developer.51cto.com/art/200908/141825.htm
http://lavasoft.blog.51cto.com/62575/38588/
http://zhouyq.iteye.com/blog/240910
indexOf
http://hhhk.iteye.com/blog/2082860
http://blog.csdn.net/xymyeah/article/details/2665840
/*public static String getWeekFirst(int year, int week){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.set(year, 0, 1);
int weeks = 0;
while((weeks = calendar.get(Calendar.WEEK_OF_YEAR))<= week){
calendar.add(Calendar.MONTH, 1);
System.out.println(calendar.get(Calendar.WEEK_OF_YEAR));
}
calendar.add(Calendar.MONTH, -1);
System.out.println(calendar.get(Calendar.WEEK_OF_YEAR));
while((weeks = calendar.get(Calendar.WEEK_OF_YEAR))< week){
calendar.add(Calendar.DATE, 1);
}
Date timec = calendar.getTime();
String xtime = sdf.format(timec);
return xtime;
}*/
/* public static String getWeekFirst(int year,int weekCount){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
//设置calendar的日期,此处可以确定某一天
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.WEEK_OF_YEAR, weekCount-1);
calendar.set(Calendar.DAY_OF_WEEK, 0);
//获取该天的信息(理论而言,通过改变get函数的参数,可以获取该天的任意信息)
int day = calendar.get(Calendar.DAY_OF_YEAR);
int[] days=new int[7];
for(int i=0;i<7;i++){
days[i] = calendar.get(Calendar.DAY_OF_MONTH);
System.out.print((calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DAY_OF_MONTH)+"日 ");
day++;
calendar.set(Calendar.DAY_OF_YEAR, day);
}
Date timec = calendar.getTime();
String xtime = sdf.format(timec);
return xtime;
}*/
public static String getWeekFirst(int year,int weekCount){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String xtime = "";
Calendar startdate = Calendar.getInstance();
startdate.set(Calendar.YEAR, year);
startdate.set(Calendar.WEEK_OF_YEAR, weekCount-1);
startdate.set(Calendar.DAY_OF_WEEK, 0);
int startday = startdate.get(Calendar.DAY_OF_YEAR);
startdate.set(Calendar.DAY_OF_YEAR, startday);
Date times = startdate.getTime();
String start = sdf.format(times);
Calendar enddate = Calendar.getInstance();
enddate.set(Calendar.YEAR, year);
enddate.set(Calendar.WEEK_OF_YEAR, weekCount-1);
enddate.set(Calendar.DAY_OF_WEEK, 0);
int endday = enddate.get(Calendar.DAY_OF_YEAR)+6;
enddate.set(Calendar.DAY_OF_YEAR, endday);
Date timee = enddate.getTime();
String end = sdf.format(timee);
xtime = start +";"+ end;
return xtime;
}
向上
WITH RECURSIVE r AS (
SELECT * FROM acu_customercircle
WHERE circleunitid = 'd05c24fa-dc32-4357-8a48-0f72efdfd85a' union ALL SELECT acu_customercircle.* FROM acu_customercircle,
r WHERE acu_customercircle.circleunitid = r.guidparentid)
SELECT * FROM r ORDER BY circleunitid;
向下
WITH RECURSIVE T (circleunitid, strname, guidparentid, dwgrade) AS (
SELECT circleunitid, strname, guidparentid, dwgrade
FROM acu_customercircle
WHERE circleunitid = '712a9d32-e7d9-41d7-b07f-42a2e8c4a827'
UNION ALL
SELECT D.circleunitid, D.strname, D.guidparentid, D.dwgrade
FROM acu_customercircle D
JOIN T ON D.guidparentid = T.circleunitid)
SELECT circleunitid, strname, guidparentid, dwgrade FROM T
ORDER BY dwgrade;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
// 全选
$("#btnCheckAll").bind("click", function () {
$("[name = chkItem]:checkbox").attr("checked", true);
});
// 全不选
$("#btnCheckNone").bind("click", function () {
$("[name = chkItem]:checkbox").attr("checked", false);
});
// 反选
$("#btnCheckReverse").bind("click", function () {
$("[name = chkItem]:checkbox").each(function () {
$(this).attr("checked", !$(this).attr("checked"));
});
});
// 全不选
$("#btnSubmit").bind("click", function () {
var result = new Array();
$("[name = chkItem]:checkbox").each(function () {
if ($(this).is(":checked")) {
result.push($(this).attr("value"));
}
});
alert(result.join(","));
});
});
</script>
</head>
<body>
<div>
<input name="chkItem" type="checkbox" value="今日话题" />今日话题
<input name="chkItem" type="checkbox" value="视觉焦点" />视觉焦点
<input name="chkItem" type="checkbox" value="财经" />财经
<input name="chkItem" type="checkbox" value="汽车" />汽车
<input name="chkItem" type="checkbox" value="科技" />科技
<input name="chkItem" type="checkbox" value="房产" />房产
<input name="chkItem" type="checkbox" value="旅游" />旅游
</div>
<div>
<input id="btnCheckAll" type="button" value="全选" />
<input id="btnCheckNone" type="button" value="全不选" />
<input id="btnCheckReverse" type="button" value="反选" />
<input id="btnSubmit" type="button" value="提交" />
</div>
</body>
</html>
在Ztree的官网Demo中,有自动展开的例子,是通过设置节点属性open:true来实现自动展开的,但是在异步加载中,这个属性设置为true也不会自动展开,因为open:true是指在有子节点的情况下展开,在异步加载之前,当前节点是没有子节点的,所以无法打开。
异步加载自动展开解决方法如下:
1.设置ztree的加载完成的回调函数:
setting = {
......
callback: {
......
onAsyncSuccess: zTreeOnAsyncSuccess
}
};
onAsyncSuccess是指加载完成后要调用的方法,其他节点的设置请参考ztree的官网Demo.
2.编写方法zTreeOnAsyncSuccess
var firstAsyncSuccessFlag = 0;
function zTreeOnAsyncSuccess(event, treeId, msg) {
if (firstAsyncSuccessFlag == 0) {
try {
//调用默认展开第一个结点
var selectedNode = zTree.getSelectedNodes();
var nodes = zTree.getNodes();
zTree.expandNode(nodes[0], true);
var childNodes = zTree.transformToArray(nodes[0]);
zTree.expandNode(childNodes[1], true);
zTree.selectNode(childNodes[1]);
var childNodes1 = zTree.transformToArray(childNodes[1]);
zTree.checkNode(childNodes1[1], true, true);
firstAsyncSuccessFlag = 1;
} catch (err) {
}
}
}
此方法可以自动加载第一级节点,try{} catch()是为了捕获节点不存在时的异常,这样可以使其不跑出js错误信息。
firstAsyncSuccessFlag变量的作用是使tree只在页面初始化后自动展开一次,因为手动点击加号展开子节点的时候也会调用此方法,通过此变量来标识是否自动加载。
function zTreeOnAsyncSuccess(event, treeId, treeNode, msg){
var treeObj = $.fn.zTree.getZTreeObj(treeId);
var node = treeObj.getNodeByParam("isParent", true, null);
treeObj.expandNode(node,true,false,true,true);
var nodes = treeObj.getNodeByParam("isParent", true, node);
if(nodes.length>0){
for(var i=0;i<nodes.length;i++){
treeObj.expandNode(nodes[i],true,false,true,true);
}
}
treeObj.selectNode(node.children[0]);
}
$(_self).on("blur",function(event){
if($.dropdown._isClose) $.dropdown.close();
event.stopPropagation();
return false;
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>分页</title>
<script type="text/javascript" src="jquery-1.2.5.js"></script>
<style>
.page { margin:20px; }
.page a {
margin:0 5px;
padding:1px 3px;
display:inline-block;
border:1px solid #000;
}
</style>
</head>
<body>
<div id="bbb">
111111111111111111111111111111111
<div class="fpage"> </div>
222222222222222222222222222222222
<div class="fpage"> </div>
333333333333333333333333333333333
<div class="fpage"> </div>
444444444444444444444444444444444
</div>
<script type="text/javascript">
var $ = function(id){
return document.getElementById(id);
};
var str = $('bbb').innerHTML.toLowerCase();
var ie = !+[1,];
var arr = ie ? str.split('<div class=fpage> </div>') : str.split('<div class="fpage"> </div>');
$('bbb').innerHTML = arr[0];
var page = document.createElement('div');
page.className = 'page';
var tmp = '';
for(var i = 1, len = arr.length; i <= len; i++){
tmp += '<a href="javascript:test('+(i-1)+');">'+i+'</a>';
}
page.innerHTML = tmp;
document.body.appendChild(page);
function test(i){
$('bbb').innerHTML = arr[i];
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js 判断鼠标位置让div消失</title>
<style type="text/css">
<!--
body{margin:0px;padding:0px;}
-->
</style>
<script>
function c()
{
document.getElementById('h_div').style.display = "";
return false;
}
function d()
{
//alert(window.event.clientX);
//alert(window.event.clientY);
var wx = window.event.clientX;
var wy = window.event.clientY;
var d_left = document.getElementById('h_div').offsetLeft;
var d_top = document.getElementById('h_div').offsetTop;
var d_width = document.getElementById('h_div').clientWidth;
var d_height = document.getElementById('h_div').clientHeight;
//alert(wx + '_' + wy + '_' + d_left + '_' + d_width + '_' + d_top + '_' + d_height)
if(wx < d_left || wy < d_top || wx > (d_left + d_width) || wy > (d_top + d_height))
document.getElementById('h_div').style.display = "none";
return false;
}
</script>
</head>
<body onClick="javascript:d();" >
<div onMouseOver="javascript:c();" style="width:150px;height:30px;margin:auto;margin-left:200px;border:1px solid red;position:relative;">
Click me
</div>
<div id="h_div" style="display:none;position:absolute;margin-top:0px;margin-left:200px;width:150px;height:100px;border:1px solid green;font-size:12px;">
<input type="checkbox" id="aa" name="aa" title=""/><label for="aa">第一个</label><br />
<input type="checkbox" id="bb" name="bb" title=""/><label for="bb">第二个</label><br />
<input type="checkbox" id="cc" name="cc" title=""/><label for="cc">第三个</label><br />
<input type="checkbox" id="dd" name="dd" title=""/><label for="dd">第四个</label><br />
<input type="checkbox" id="ee" name="ee" title=""/><label for="ee">第五个</label><br />
</div>
</body>
</html>
<html>
<head>
<title> tb </title>
<script>
window.onload = function(){
var tbl = document.getElementById("tb");
for(var i = 0; i < tbl.rows.length; i++){
tbl.rows[i].cells[0].innerText = "ddddddd";//自动在每行第一个单元格内填入内容
if(i % 2 == 0){//偶数行背景色为红色
tbl.rows[i].style.backgroundColor = 'red';
}//基数行背景色为蓝色
else tbl.rows[i].style.backgroundColor = "blue";
}
}
</script>
</head>
<body`>
<table width="500" border= "1" id= "tb">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
package test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class week {
public static void main(String[] args) {
List<Usa> list1 = new ArrayList<Usa>();
list1.add(new Usa("1","name1"));
list1.add(new Usa("2","name2"));
list1.add(new Usa("3","name3"));
List<Usa> list2 = new ArrayList<Usa>();
list2.add(new Usa("1","name1"));
list2.add(new Usa("2","name3"));
list2.add(new Usa("3","name3"));
list2.add(new Usa("4","name4"));
List<Usa> res = theDiffOfList(list1,list2,true);
StringBuffer sb = new StringBuffer();
for(Usa u : res){
sb.append(u.getId() + "-" + u.getName() + ";");
}
System.out.println("insert:"+sb);
List<Usa> res2 = theDiffOfList(list1,list2,false);
sb = new StringBuffer();
for(Usa u : res2){
sb.append(u.getId() + "-" + u.getName() + ";");
}
System.out.println("del:"+ sb);
}
private static List<Usa> theDiffOfList(List<Usa> a,List<Usa> b,Boolean isAdd){
List<Usa> diff = new ArrayList<Usa>();
List<Usa> tmpa = new ArrayList<Usa>(Arrays.asList(new Usa[a.size()]));
Collections.copy(tmpa, a);
List<Usa> tmpb = new ArrayList<Usa>(Arrays.asList(new Usa[b.size()]));
Collections.copy(tmpb, b);
if(isAdd){
tmpa.removeAll(tmpb);
for(Usa u : tmpa){
diff.add(u);
}
}else{
tmpb.removeAll(tmpa);
for(Usa u : tmpb){
diff.add(u);
}
}
return diff;
}
}
class Usa{
private String id ;
private String name;
public Usa(String id, String name) {
super();
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Usa other = (Usa) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
SELECT AA,BB FROM AAAA MINUS SELECT AA,BB ,CC FROM CC
create table CCCC(
AA varchar2(2) not null,
BB varchar2(10),
cc varchar2(10)
)
--比较两个表的数据是否一致--
select AA,BB from AAAA a where NOT exists(select AA,BB from BBBB b where a.AA= b.AA and a.BB=b.BB)
select AA,BB from BBBB a where NOT exists(select AA,BB from AAAA b where a.AA= b.AA and a.BB=b.BB)
select * from BBBB a where NOT exists(select * from AAAA b where a.AA= b.AA and a.BB=b.BB)
select * from BBBB
SELECT * FROM AAAA
1. 在执行速度方面的比较:StringBuilder > StringBuffer
2. StringBuffer与StringBuilder,他们是字符串变量,是可改变的对象,每当我们用它们对字符串做操作时,实际上是在一个对象上操作的,不像String一样创建一些对象进行操作,所以速度就快了。
3. StringBuilder:线程非安全的
StringBuffer:线程安全的
当我们在字符串缓冲去被多个线程使用是,JVM不能保证StringBuilder的操作是安全的,虽然他的速度最快,但是可以保证StringBuffer是可以正确操作的。当然大多数情况下就是我们是在单线程下进行的操作,所以大多数情况下是建议用StringBuilder而不用StringBuffer的,就是速度的原因。
对于三者使用的总结:1.如果要操作少量的数据用 = String
2.单线程操作字符串缓冲区 下操作大量数据 = StringBuilder
3.多线程操作字符串缓冲区 下操作大量数据 = StringBuffer
相关推荐
一个功能简单的选课系统 管理员默认帐号和密码均为51aspx 数据库文件在DB_51aspx文件夹中,附加即可 默认数据库名称class,用户名sa,密码sasasa 默认学生帐号001 stuinfo.aspx 学生管理 tec.aspx...
一个功能简单的选课系统 ...数据库文件在DB_51aspx文件夹中,附加即可 默认数据库名称class,用户名sa,密码sasasa 默认学生帐号001 stuinfo.aspx 学生管理 tec.aspx 教师管理 addc.aspx 添加课单表
pwd=sasasa"); SqlDataAdapter adapter = new SqlDataAdapter("select * from Customers", conn); Console.WriteLine("填充前:" + conn.State.ToString()); DataSet ds = new DataSet(); adapter.Fill(ds, "s"); ...
1. **创建登录账号**:在SQL Server的安全性设置中创建一个新的登录账户,例如使用用户名sa,并设置密码为`sasasa`。 2. **启用TCP/IP**:打开SQL Server Configuration Manager,确保TCP/IP协议已经被启用。 3. **...
在示例代码中,连接字符串指定了服务器(本地)、数据库名称(这里为“�����洢”)、用户名(sa)和密码(sasasa)。创建好连接后,接下来创建SqlCommand对象,将存储过程的名称(如"Test_Insert")作为参数,...
#hibernate.connection.password sasasa #hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb ## Mckoi SQL #hibernate.dialect org.hibernate.dialect.MckoiDialect #hibernate.connection....
logInfo.ConnectionInfo.Password = "sasasa"; logInfo.ConnectionInfo.DatabaseName = "CrystalRepeat"; ... rptDoc.Database.Tables[i].ApplyLogOnInfo(logInfo); ``` - `TableLogOnInfo`: 用于存储表的登录信息。...
pwd=sasasa"; SqlConnection cn1 = new SqlConnection(ConnectionString); SqlCommand cmd1 = cn1.CreateCommand(); cmd1.CommandText = "SELECT * FROM dbo.ABCD"; cn1.Open(); cmd1.ExecuteReader(); cn1.Close();...
"托盘装载问题" 在物流供应链中,托盘装载问题是一个非常重要的研究课题。随着我国经济的发展,物流需求日益增长,传统的托盘存储方式已经不能满足现代物流的需求。托盘已经成为衡量一个国家物流效率水平的重要标志...
时间操作模块.ec