瞧瞧生成的HTML有什么变化没,找到差别再修改你的JS

解决方案 »

  1.   

    myTreeView = document.getElementById('<%=TreeView1.ClientID%>');
      

  2.   

    恩,是个好提议哦,刚才对比了一下,确实很大不同,高手帮分析一下:
    2003的Html代码,只贴出表示一个节点的部分:
    <tvns:treenode Expanded="True" NavigateUrl="Switch.aspx?Action=1&amp;ClassID=109" ImageUrl="../../DataImages/page.gif" Target="MainFrame" ID="109">
    <span onmousemove=javascript:title='公司论坛'>公司论坛</span>
    </tvns:treenode>2005的:
    <table cellpadding="0" cellspacing="0" style="border-width:0;">
    <tr>
    <td><img src="/macalia_job2/WebResource.axd?d=Fma7phtUvS4z3_0iyfadzia1znMoN6bAxMrsodm5f1I1&amp;t=633777689284687500" alt="" /></td><td><a href="Switch.aspx?Action=1&amp;ClassID=109" target="MainFrame" id="ControlProjectTreeView1_TreeView1t11i" tabindex="-1"><img src="../../DataImages/page.gif" alt="" style="border-width:0;" /></a></td><td style="white-space:nowrap;"><a href="Switch.aspx?Action=1&amp;ClassID=109" target="MainFrame" id="ControlProjectTreeView1_TreeView1t11" style="text-decoration:none;"><span onmousemove=javascript:title='公司论坛'>公司论坛</span></a></td>
    </tr>
    </table>
    2005的还多生成了下面的脚本代码:
    <script type="text/javascript">
    <!--
    var theForm = document.forms['Projecttreeview'];
    if (!theForm) {
        theForm = document.Projecttreeview;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    // -->
    </script><script src="/macalia_job2/WebResource.axd?d=1jSIUn8MyTFmu1kNXekkQg2&amp;t=633777689284687500" type="text/javascript"></script>2003的还有这些:
    <?XML:NAMESPACE PREFIX=TVNS />
    <?IMPORT NAMESPACE=TVNS IMPLEMENTATION="/webctrl_client/1_0/treeview.htc" />
    <tvns:treeview id="ControlProjectTreeView1_TreeView1" defaultStyle="background:#024289;color:white;" hoverStyle="color:#e8f4ff;" selectedStyle="color:#e8f4ff;" selectedNodeIndex="0" HelperID="__ControlProjectTreeView1_TreeView1_State__" systemImagesPath="/webctrl_client/1_0/treeimages/" selectExpands="true" onexpand="javascript: if (this.clickedNodeIndex != null) this.queueEvent('onexpand', this.clickedNodeIndex)" oncollapse="javascript: if (this.clickedNodeIndex != null) this.queueEvent('oncollapse', this.clickedNodeIndex)" oncheck="javascript: if (this.clickedNodeIndex != null) this.queueEvent('oncheck', this.clickedNodeIndex)" onselectedindexchange="javascript: if (event.oldTreeNodeIndex != event.newTreeNodeIndex) this.queueEvent('onselectedindexchange', event.oldTreeNodeIndex + ',' + event.newTreeNodeIndex)" style="display:inline-block;border-color:White;border-width:0px;height:100%;width:178px;">
      

  3.   

    又研究了一下html,用children可以获取table或者div元素,不过2005的treeview的节点id显示的不是后台cs定义的value,唉,烦人
    搞微软的真是郁闷