MyTree树控件_Ajax实现异步加载节点
最近一直在寻找一个比较方便好用的树控件,MyTree树控件并没有提供很多其他的功能,但在Ajax异步加载节点上实现的很简洁,留作备忘。
MyTree的下载地址:http://www.itplus.com.cn/myTree/
下载后 Demo:Ajax异步加载例子
Document:文档
myTree:放项目里要引用的文件
MytreeTest.aspx页
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MytreeTest.aspx.cs" Inherits="VistaToNewSchol.MytreeTest" %>
<!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 language="javascript" src="../myTree/myTree.js"></script>
<script language="javascript" src="../myTree/bingo.js"></script>
<script language="javascript">
var tree;
window.onload = function(){
tree = new myTree("myFirstTree", "divTree", "../myTree/", "Blue");
tree.datafrom = "MyTreeGetNode.aspx"
tree.load();
}
function myFirstTree_onClick(prmNodeId){
tree.load(prmNodeId);
tree.expandNode(prmNodeId);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="divTree"></div>
<div id="divStr"></div>
</form>
</body>
</html>
&
相关文档:
页面代码:
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManage ......
使用原始的XMLHttpRequest发出请求时,只能对Servlet和JSP操作
在JSP中创建3个function
1.createXmlHttpRequest----负责判断浏览器类型创建 XMLHttpRequest对象
var xmlHttpRequest;
function createXMLHttpRequest(){
// IE 浏览器
if(window.ActiveXObject){
&nbs ......
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1是updatepanel的id
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1是updatepanel的id
......
A.aspx页面放一个dropdownlist,在A.aspx.cs添加: this.drpSchool.Attributes.Add("onchange", "load(this.options[this.selectedIndex].value)");
在A.aspx页面添加如下脚本:
function load(state){
var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
var oDoc = new ActiveXObject("MSXML2.DOMDocument");
......