时间:2021-07-01 10:21:17 帮助过:19人阅读
<script type="text/javascript">
$().ready(function()
{
$("img[src$=tv_NoExpend.jpg]").each(function()//筛选出所有的父级node
{
//ctl00_body__menuTreet4i//父级node的id是这样的规则:ctl00_body__menuTreet加id加i
var id = $(this).parent().attr("id").replace("ctl00_body__menuTreet","").replace("i","");
var nId = 'ctl00_body__menuTreen'+id;
BindExpandJs($("#ctl00_body__menuTreet"+id+"i"),nId);//给‘文件夹'图片绑定事件
BindExpandJs($("#ctl00_body__menuTreet"+id),nId); //给'文本节点'绑定事件 });
});
function BindExpandJs(obj,nId)
{
$(obj)
.css("cursor","pointer")
.removeAttr("href")
.click(function()
{
TreeView_ToggleNode(ctl00_body__menuTree_Data,0,document.getElementById(nId),' ',document.getElementById(nId+'Nodes'));
});
}
</script>