您的位置:程序门 -> web 开发 -> javascript



求一个递归函数


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


求一个递归函数
发表于:2007-04-26 16:30:56 楼主
求一个js递归函数
用js解析xml文件实现表格分级结构

具体结构如:


a
      b
                c
                d
      e
                f
                g
                h
                        i
                        j
      k        
                l
                        m
                        n
      o        
                p      
                q

如此结构,
需要表格表示
请各位赐教
发表于:2007-04-26 16:33:061楼 得分:0
不好意思,,,
这个提问中的数结构没有所见即所得,,,
结构没有显现出来

其实就是用表格来表示树形结构,能够一目了然
发表于:2007-04-26 16:33:502楼 得分:0
需求描述不清楚,xml文件表达有误.

你问问题还嫌麻烦的话就不要问好了,回答的人更嫌麻烦.

话说多了,默念一百遍:做人要厚道!   sorry啊,飘过了....
发表于:2007-04-26 16:38:093楼 得分:0
路过,递归还行,不熟xml..
发表于:2007-04-26 16:42:494楼 得分:0
在ie中,可以把xml作为table的数据源的,直接显示出来
datasrc   attribute   ¦   datasrc   property     internet   development   index  

--------------------------------------------------------------------------------

sets   or   retrieves   the   source   of   the   data   for   data   binding.

syntax

html   <element   datasrc   =   sid...   >    
scripting   object.datasrc   [   =   sid   ]  

possible   values

sid   string   that   specifies   or   receives   the   identifier   of   the   data   source.  

the   property   is   read/write.   the   property   has   no   default   value.

expressions   can   be   used   in   place   of   the   preceding   value(s),   as   of   microsoft&reg;   internet   explorer   5.   for   more   information,   see   about   dynamic   properties.

remarks

tabular   and   single-valued   data   consumers   use   the   datasrc   property   to   specify   a   binding.   the   property   takes   a   string   that   corresponds   to   the   unique   identifier   of   a   data   source   object   (dso)   on   the   page.   the   string   must   be   prefixed   by   a   number   sign   (#).

when   the   datasrc   property   is   applied   to   a   tabular   data   consumer,   the   entire   data   set   is   repeated   by   the   consuming   elements.

when   the   datasrc   property   is   applied   to   a   table,   any   contained   single-valued   consumer   objects   that   specify   a   datafld   property   are   repeated   for   each   record   in   the   supplied   data   set.   to   complete   the   binding,   the   binding   agent   interrogates   the   enclosing   table   for   its   data   source.   a   tabular   data   consumer   contained   within   another   tabular   data   consumer   (table)   must   specify   an   explicit   datasrc.

example

in   this   example,   a   text   box   is   bound   to   the   customer_name   field   of   a   data   source   object   with   an   id   of   "customer ".   because   the   text   box   is   located   within   a   data-bound   table,   the   text   box   is   repeated   to   display   each   of   the   records   provided   by   the   data   source.

<table   datasrc= "#customer ">
<tr> <td> <input   type=textbox   datafld= "customer_name "> <td> <tr>
</table>
standards   information

there   is   no   public   standard   that   applies   to   this   property.  

发表于:2007-04-26 17:37:405楼 得分:0
我的意思是

用js解析一个不规则的xml文件,将其用表格将xml树中各节点元素按照
a______
_______b
___________c
___________d
_______e
___________f
___________g
_______________h
__________________i
__________________j
_______k
____________l

如上所示:(以下指示举例,元素并不是固定这么多的)
a   的子元素有b,e,k
b的子元素有c,d
e的子元素有f,g
k的字元素有l
然后g的字元素是h
h的字元素是i   ,j
html中的效果就是类似如上图中没有下划线的布局
发表于:2007-04-26 17:40:146楼 得分:0
树中元素较多,
需要使用递归来得到html字符串来显示   到页面上
发表于:2007-04-26 20:26:327楼 得分:0
答案就在   asp.net   2.0   treeview   编译后的   html   页面中。

读懂哪个结构你就知道该怎么做了!
发表于:2007-04-27 09:05:368楼 得分:0
可我是用js解析,
.net   我不熟啊


快速检索

最新资讯
热门点击