function public_GetParentByTagName(element
{
var parent = element
var upperTagName = tagName
//如果這個元素還不是想要的tag就繼續上溯
while (parent && (parent
{
parent = parent
}
return parent;
}
//設置節點的父節點Cheched——該節點可訪問
function setParentChecked(objNode)
{
var objParentDiv = public_GetParentByTagName(objNode
if(objParentDiv==null || objParentDiv == "undefined")
{
return;
}
var objID = objParentDiv
objID = objID
objID = objID+"CheckBox";
var objParentCheckBox = document
if(objParentCheckBox==null || objParentCheckBox == "undefined")
{
return;
}
if(objParentCheckBox
return;
objParentCheckBox
setParentChecked(objParentCheckBox);
}
//設置節點的子節點uncheched——該節點不可訪問
function setChildUnChecked(divID)
{
var objchild = divID
var count = objchild
for(var i=
{
var tempObj = objchild[i];
if(tempObj
{
tempObj
}
setChildUnChecked(tempObj);
}
}
//設置節點的子節點cheched——該節點可以訪問
function setChildChecked(divID)
{
var objchild = divID
var count = objchild
for(var i=
{
var tempObj = objchild[i];
if(tempObj
{
tempObj
}
setChildChecked(tempObj);
}
}
//觸發事件
function CheckEvent()
{
var objNode = event
if(objNode
return;
if(objNode
{
setParentChecked(objNode);
var objID = objNode
var objID = objID
var objParentDiv = document
if(objParentDiv==null || objParentDiv == "undefined")
{
return;
}
setChildChecked(objParentDiv);
}
else
{
var objID = objNode
var objID = objID
var objParentDiv = document
if(objParentDiv==null || objParentDiv == "undefined")
{
return;
}
setChildUnChecked(objParentDiv);
}
}
服務端控件
this
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19990.html