📄 lefttreeajax.aspx
字号:
<!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>
<title>AJAX MenuTree</title>
<style type="text/css">
body { line-height:20px; font-size:12px; background:#EFEFEF;}
.load { padding:2px 2px 0px 2px; line-height:18px; display:inline; color:#FFF; background:#69C;}
.text0 { padding:2px 0px 0px 2px; line-height:18px; display:block; color:#069; text-decoration:none;}
.text0:hover { color:#000; background:#CCC;}
.text1 { padding:2px 0px 0px 2px; line-height:18px; display:block; color:#FFF; text-decoration:none; background:#69C;}
a:link{padding 2px 0px 0px 2px;line-height:18px;display:block;color:#069;text-decoration:none;}
a:visited{padding 2px 0px 0px 2px;line-height:18px;display:block;color:#069;text-decoration:none;bgckground:#CCC}
a:hover{padding 2px 0px 0px 2px;line-height:18px;display:block;color:#069;text-decoration:none;background:#69C;}
.folder_close { padding-left:38px; background-image:url(images/P1.gif); background-repeat:no-repeat; height:20px; cursor:pointer;}
.folder_open { padding-left:38px; background-image:url(images/M1.gif); background-repeat:no-repeat; height:20px; cursor:pointer;}
.folder_close_end { padding-left:38px; background-image:url(images/P2.gif); background-repeat:no-repeat; height:20px; cursor:pointer;}
.folder_open_end { padding-left:38px; background-image:url(images/M2.gif); background-repeat:no-repeat; height:20px; cursor:pointer;}
.file { padding-left: 38px; background-image: url(images/L1.gif); background-repeat: no-repeat; height: 20px; cursor: pointer;}
.file_end { padding-left: 38px; background-image: url(images/L2.gif); background-repeat: no-repeat; height: 20px; cursor: pointer;}
.list0 { padding-left: 20px; background-image: url(images/L4.gif); background-repeat: repeat-y;}
.list1 { padding-left: 20px;}
</style>
<script language="javascript" type="text/javascript">
// <!CDATA[
var xmlHttp;
var ShowID;
var ParID;
//创建对象
function createXMLHttpRequest()
{
var isRight = true;
try{ xmlHttp = new XMLHttpRequest(); }
catch(trymicrosoft)
{
try{xmlHttp = new ActiveXobject("Msxml2.XMLHTTP");}
catch(othermicrosoft)
{
try{xmlHttp = new ActiveXobject("Microsoft.XMLHTTP");}
catch(failed)
{
isRight = false;
}
}
}
if(!isRight)
alert("XML对象创建失败");
}
//获取数据
function GetData(ID)
{
ParID = document.getElementById("M1_" + ID);
ShowID = document.getElementById("M2_" + ID);
if(ShowID.innerHTML != "")
{
if(ShowID.style.display == "none")
ShowID.style.display = "block";
else
ShowID.style.display = "none";
ShowFolderICO();
return;
}
ShowID.style.display = "block";
ShowID.innerHTML = "<span class=\"load\">Loading Tree ……</span>";
var Url = "CreateTreeAjax.aspx?ID=" + ID;
createXMLHttpRequest();
xmlHttp.onreadystatechange = ShowTree;
xmlHttp.open("GET", Url, true);
xmlHttp.send(null);
}
//此方法直接从服务器端返回HTML
function ShowTree()
{
if (xmlHttp.readyState == 4){
if (xmlHttp.status == 200)
{
ShowID.innerHTML = xmlHttp.responseText;
// alert(xmlHttp.responseText);
ShowFolderICO();
//alert(M1_DCCK.innerHTML);
}else
{
ShowID.innerHTML = "数据获取错误!"+xmlHttp.status;
}
}
}
//改变文件夹图标打开/关闭状态
function ShowFolderICO()
{
if (ParID != null){
if (ParID.className == "folder_close")
ParID.className = "folder_open";
else if (ParID.className == "folder_open")
ParID.className = "folder_close";
else if (ParID.className == "folder_close_end")
ParID.className = "folder_open_end";
else if (ParID.className == "folder_open_end")
ParID.className = "folder_close_end";
}
}
// ]]>
</script>
</head>
<body onload="GetData(0)">
<input type="hidden" id="MeID" value="" />
<div><img src="images/root.gif" alt="RootNote" /></div>
<div id="M2_0" style="display:block;"></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -