js實現樹形內容展示

來源:互聯網
上載者:User

標籤:20px   require   地址   代碼   auto   blog   value   alt   display   

 

 

1.首先這裡有一個demo,裡邊有封裝好的js檔案。地址:http://files.cnblogs.com/files/feifeishi/dtree.zip

2.直接上代碼

<div style="height:auto;margin-left: 20px;">                                      <s:iterator value="targetlist">    <input type="text" style="display:none" value="<s:property value="id.targetnumber.trim()"/>" class="targetnumber">  </s:iterator>  <s:iterator value="requirementlist">    <input type="text" style="display:none" value="<s:property value="id.requirementnumber.trim()"/>" class="requirementnumber">  </s:iterator>                  <s:iterator value="pointlist">    <input type="text" style="display:none" value="<s:property value="id.pointnumber.trim()"/>" class="pointnumber">  </s:iterator>                  <script type="text/javascript">d = new dTree(‘d‘);d.add(0,-1,‘培養要求樹‘);d.add(10,0,‘培養要求‘);$(‘.targetnumber‘).each(function(){d.add(this.value,10,‘培養目標‘+this.value,‘Target4.action?targetnumber=‘+this.value+‘‘, ‘‘, ‘main‘);});$(‘.requirementnumber‘).each(function(){d.add(this.value,this.value.substring(0,1),‘畢業要求‘+this.value,‘Point.action?requirementnumber=‘+this.value+‘‘, ‘‘, ‘main‘);});$(‘.pointnumber‘).each(function(){d.add(this.value,this.value.substring(0,2),‘指標點‘+this.value,‘PointPoint.action?requirementnumber=‘+this.value+‘‘, ‘‘, ‘main‘);});document.write(d);</script>

  前半部分的s標籤是獲得action中傳過來的list的值,從而使js可以使用這些值。js中是寫樹的節點,列印樹。

3.效果:

4.檔案中有一個api,其中有重要的參數資訊

 

js實現樹形內容展示

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.