⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaulttree.aspx

📁 d:我的文档桌面asp_net中使用AJAX实现DropDownList连动及多级菜单 - ASP-ASP_NET - Web程序开发 - 中国IT信息技术论坛 -精心打造最专业的IT信息及IT技术服
💻 ASPX
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultTree.aspx.cs" Inherits="DefaultTree" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.stylespan
 {
   font: normal 11px arial, tahoma, helvetica, sans-serif;
 }

.stylediv
{
  vertical-align: bottom;
  margin-top:0px; 
  height:18px;
  border-width:0px 0px 0px 0px;

}

.Node-selected
 {        
        vertical-align: bottom;
		text-align:center;
		border:1px solid #000000;
		background-color:#EAEAEA;
		font: normal 11px arial, tahoma, helvetica, sans-serif;
 }
	
.Node-unselect
	{
	    text-align:center;
		border:0px solid #FFFFFF;
		background-color:transparent;
	    font: normal 11px arial, tahoma, helvetica, sans-serif;
		vertical-align: bottom;
	}

a {  color: #000000; text-decoration: none;cursor: hand}

a:hover {  color: #000000; text-decoration: none;cursor:hand}

.img
{
  border:0px 0px 0px 0px;
  width:18px;
  height:18px;
}

.imgDef
{
  border:0px 0px 0px 0px;
  width:16px;
  height:16px;
}

-->
</style>
</head>
<script language=javascript>
//-------------------------checkboxi 对应1  spani 


function findParent(ChildBox,action)
{
   
   var Par=ChildBox.parentElement;
   
   if(action=="true") 
   {    while(Par!=null)
       {   
           
           if(typeof(Par.belongCheckbox)!="undefined")
           {
               //alert(Par.belongCheckbox);
               document.getElementById(Par.belongCheckbox).checked="checked";
           }
           Par=Par.parentElement;
       } 
   }
   else
   {     
         Par=Par.parentElement;                                
         //alert(Par.id);
         if(typeof(Par.belongCheckbox)!="undefined")
         {
              var flag=true;
              var checkBox=Par.getElementsByTagName("input");  //得到父接点的所有checkbox
              for(var i=0;i<checkBox.length;i++)
              {
                 if(checkBox[i].checked)
                 {
                     flag=false;                  //还有checkbox 选种
                     break;              
                 }
              }
              if(flag)
              {   
                  document.getElementById(Par.belongCheckbox).checked="";
                  findParent(document.getElementById(Par.belongCheckbox),"false");     
              }
         }
      
   
   } 
}

function SelectBox(diving,obj)
{    
    //---------Checkbox1
    
    document.getElementById("TextNode").value=document.getElementById("span_"+obj.id.replace("Checkbox","")).innerText;
    
    if(obj.checked)   
    {
      obj.checked="checked";
      if(document.getElementById(diving)!=null)
      {  
         var checkbox=document.getElementById(diving).getElementsByTagName("input");
         for(var i=0;i<checkbox.length;i++)
                checkbox[i].checked="checked";
      }
      findParent(obj,"true"); 
    }
    else
    {
         
      obj.checked="";
      if(document.getElementById(diving)!=null)
      {  
         var checkbox=document.getElementById(diving).getElementsByTagName("input");
         for(var i=0;i<checkbox.length;i++)
                checkbox[i].checked="";
      }
      findParent(obj,"false");          //加如子接点全不取消选中,但是他的父结点还是选中(bug) 
    }
}

function ClickMenu(diving,plusing,num)
{ 
  
  if(document.getElementById(diving).style.display=="none")   //-----说明是合并状态
  {
     document.getElementById(diving).style.display='block';
     if(plusing=="plus")
     {
       document.getElementById(plusing+num).src="minus.gif";
     }
     else if(plusing=="nolines")
     {
       document.getElementById(plusing+num).src="minus_nolines.gif";
     } 
     else if(plusing=="bottom")
     {
       document.getElementById(plusing+num).src="minus_bottom.gif";
     }
     document.getElementById("open"+num).src="close.gif";

                
  }
  else    //-----说明是张开状态
  {
     document.getElementById(diving).style.display='none';
     if(plusing=="plus")
     {
       document.getElementById(plusing+num).src="plus.gif";
     }
     else if(plusing=="nolines")
     {
       document.getElementById(plusing+num).src="plus_nolines.gif";
     } 
     else if(plusing=="bottom")
     {
       document.getElementById(plusing+num).src="plus_bottom.gif";
     }
     document.getElementById("open"+num).src="open.gif"; 

  }
  
}

function ChangeColora(obj)
{
 
   obj.className='Node-selected';
}

function ChangeColorb(obj)
{
 
   obj.className='Node-unselect';

}


</script>

<body>
<form runat=server>
 节点文本: <input id="TextNode" value="有checkbox才有在用" type="text" />
    &nbsp;
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -