zoukankan      html  css  js  c++  java
  • ASP递归层级表格数据展示

    代码 如下:

    <!--#include file="include/config.asp"-->
    <!--#include file="common/sub_function.asp"-->
    <htm>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>2012年6月工程进度报审表</title>
    </head>
    <body>
    <table border="1"  cellpadding="0" cellspacing="0">
      <tr>
        <td width="260">项目费用名称</td>
        <td width="120">分项权重%</td>
        <td width="120">截止上月累计进度完成%</td>
        <td width="120">本月完成进度%(或里程碑点)</td>
        <td width="120">截止本月累计进度完成%</td>
        <td width="120">备注</td>
        </td>
      </tr>
      <%call wbs_tree(93,1)%>
    </table>
    <%
    Function wbs_tree(id,i)
    strSQL="SELECT * from PLN_projwbs where parent_wbs_id="&id&" order by seq_num"
    Set rsTest = Server.CreateObject("ADODB.Recordset") '打开纪录集对象
    rsTest.Open strSQL, cnn 
    if not rsTest.eof then
        do while not rsTest.eof 
            wbs_id = rsTest("wbs_id")' WBS主键ID
            wbs_name=rsTest("wbs_name")'WBS名称
            haschild = ccint(rsTest("haschild"))'是否有子节点
            style = " style=""padding-left:"&(i*30)-30&"px"""'左填充WBS名称
            response.Write("<tr><td"&style&">"&wbs_name&"</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr>")
            if haschild=1 then
                call wbs_tree(wbs_id,i+1)'i为层级数
            end if
        rsTest.movenext
        loop
        rsTest.close 
        set rsTest=nothing 
    end if
    End Function
    %>
    </body>
    </html></html>
    <!--#include file="include/dispose.asp"-->

    运行效果图如下:

  • 相关阅读:
    课程作业06-汇总整理
    课程作业04-汇总整理
    课程作业04-字串加密解密
    课程作业03-你已经创建了多少个对象?
    课程作业03-汇总整理
    课程作业02-汇总整理
    02-实验性问题总结归纳
    猜数字游戏
    RandomStr实验报告(验证码实验)
    个人总结
  • 原文地址:https://www.cnblogs.com/webczw/p/2780155.html
Copyright © 2011-2022 走看看