在我的 asp.net 解决方案中,我有一个 asp.net 树视图,我想对其进行一些客户端操作。我基本上是在 jQuery 中寻找一种方法来做
- 遍历所有根节点
- 遍历给定节点的所有子节点
- 获取给定节点的文本
- 获取给定节点的值
- 在给定节点的文本周围添加蓝色突出显示
- 展开/折叠给定节点
我也不想使用任何其他类型的 jQuery 树视图插件。有谁知道是否有人做过一个项目来做到这一点?或者可以提供链接或代码来做到这一点?
谢谢。
编辑:
以下是 HTML 结构的示例:
<DIV id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn0 href="javascript:TreeView_ToggleNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data,0,ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn0,' ',ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn0Nodes)"><IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" alt="Collapse 1. A" src="/WebResource.axd?d=oKkfR-BHb97Y7tPLeoIZ5CuPUYp5n51Q4XEiQRUTaq1HISixWa68nxn2YUcnu0P4F-QpKQAcYmkDFOY--39rPe3LvzCxPUlUASBT63y5J9TTXtUk0&t=634605054607203927"></A></TD>
<TD style="WHITE-SPACE: nowrap" class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_2><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt0 class="ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_1" onclick="javascript:TreeView_ToggleNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data,0,ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn0,' ',ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn0Nodes)" href="javascript:void(0);" target=_self>1. A</A></TD>
</TR>
</TBODY>
</TABLE>
<DIV style="DISPLAY: block" id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn0Nodes>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<DIV style="WIDTH: 20px; HEIGHT: 1px"></DIV>
</TD>
<TD><IMG alt="" src="/WebResource.axd?d=wVUEBOQcgjQn-5A_RWLY_fRfV16DlyE_TEShuFyVd0dtheEKaRWia9U8hMe7BvBalON1Kc8T7hXyEcYAYP1zafcbfrHc3IQbxc_merS67hdm_-KX0&t=634605054607203927"></TD>
<TD style="WHITE-SPACE: nowrap"><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt1 class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 onclick="javascript:TreeView_SelectNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data, this,'ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt1');" href='javascript:DisplayPDF("ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_pdf_and_searchResults_container","http://mydomain/mylibrary/1. A/5.5 Quick Reference Guide.pdf","850","1100", null);' target=_self>1. 5.5 Quick Reference Guide</A></TD>
</TR>
</TBODY>
</TABLE>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<DIV style="WIDTH: 20px; HEIGHT: 1px"></DIV>
</TD>
<TD><IMG alt="" src="/WebResource.axd?d=wVUEBOQcgjQn-5A_RWLY_fRfV16DlyE_TEShuFyVd0dtheEKaRWia9U8hMe7BvBalON1Kc8T7hXyEcYAYP1zafcbfrHc3IQbxc_merS67hdm_-KX0&t=634605054607203927"></TD>
<TD style="WHITE-SPACE: nowrap"><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt2 class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 onclick="javascript:TreeView_SelectNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data, this,'ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt2');" href='javascript:DisplayPDF("ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_pdf_and_searchResults_container","http://mydomain/mylibrary/1. A/5.6 Upgrade.pdf","850","1100", null);' target=_self>2. 5.6 Upgrade</A></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn3 href="javascript:TreeView_ToggleNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data,3,ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn3,' ',ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn3Nodes)"><IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" alt="Collapse 2. B" src="/WebResource.axd?d=oKkfR-BHb97Y7tPLeoIZ5CuPUYp5n51Q4XEiQRUTaq1HISixWa68nxn2YUcnu0P4F-QpKQAcYmkDFOY--39rPe3LvzCxPUlUASBT63y5J9TTXtUk0&t=634605054607203927"></A></TD>
<TD style="WHITE-SPACE: nowrap" class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_2><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt3 class="ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_1" onclick="javascript:TreeView_ToggleNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data,3,ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn3,' ',ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn3Nodes)" href="javascript:void(0);" target=_self>2. B</A></TD>
</TR>
</TBODY>
</TABLE>
<DIV style="DISPLAY: block" id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn3Nodes>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<DIV style="WIDTH: 20px; HEIGHT: 1px"></DIV>
</TD>
<TD><IMG alt="" src="/WebResource.axd?d=wVUEBOQcgjQn-5A_RWLY_fRfV16DlyE_TEShuFyVd0dtheEKaRWia9U8hMe7BvBalON1Kc8T7hXyEcYAYP1zafcbfrHc3IQbxc_merS67hdm_-KX0&t=634605054607203927"></TD>
<TD style="WHITE-SPACE: nowrap"><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt4 class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 onclick="javascript:TreeView_SelectNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data, this,'ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt4');" href='javascript:DisplayPDF("ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_pdf_and_searchResults_container","http://mydomain/mylibrary/2. B/8830 Downloading PodCasts.pdf","850","1100", null);' target=_self>1. 8830 Downloading PodCasts</A></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn5 href="javascript:TreeView_ToggleNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data,5,ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn5,' ',ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn5Nodes)"><IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" alt="Collapse 3. C" src="/WebResource.axd?d=oKkfR-BHb97Y7tPLeoIZ5CuPUYp5n51Q4XEiQRUTaq1HISixWa68nxn2YUcnu0P4F-QpKQAcYmkDFOY--39rPe3LvzCxPUlUASBT63y5J9TTXtUk0&t=634605054607203927"></A></TD>
<TD style="WHITE-SPACE: nowrap" class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_2><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt5 class="ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_1" onclick="javascript:TreeView_ToggleNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data,5,ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn5,' ',ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn5Nodes)" href="javascript:void(0);" target=_self>3. C</A></TD>
</TR>
</TBODY>
</TABLE>
<DIV style="DISPLAY: block" id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewn5Nodes>
<TABLE style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<DIV style="WIDTH: 20px; HEIGHT: 1px"></DIV>
</TD>
<TD><IMG alt="" src="/WebResource.axd?d=wVUEBOQcgjQn-5A_RWLY_fRfV16DlyE_TEShuFyVd0dtheEKaRWia9U8hMe7BvBalON1Kc8T7hXyEcYAYP1zafcbfrHc3IQbxc_merS67hdm_-KX0&t=634605054607203927"></TD>
<TD style="WHITE-SPACE: nowrap"><A id=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt6 class=ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_0 onclick="javascript:TreeView_SelectNode(ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeview_Data, this,'ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_my_treeviewt6');" href='javascript:DisplayPDF("ctl00_m_g_7276d5bd_969d_40e4_b299_08b2f89c43e9_ctl00_pdf_and_searchResults_container","http://mydomain/mylibrary/3. C/8830 International Roaming.pdf","850","1100", null);' target=_self>1. 8830 International Roaming</A></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</DIV>