开发者

Re-assigning an array in ASP classic

I have the following function, designed to walk through XML and create a linear structure of all nodes:

function get_children(n)
  if n.hasChildNodes() then
    for each child in n.childNodes
      set local_array = array_merge(get_children(child), local_array)
    next
  else
    set local_array = Array(n)
  end if
  get_children = local_array
end function

I've tried a ton of variations, but I keep 开发者_运维百科getting errors on the line

set local_array = Array(n)

It it's current form, I see:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required
/_inc/nav/left-nav.inc, line 37

Am I mis-using the Array() construct? Aren't I able to create an array with a single value?


Change

set local_array = Array(n)  

to

local_array = Array(0)
set local_array(0) = n 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜