get all ids of children of a particular element

get all ids of children of a particular element

if i have:

div id=top
div id=1
div id=2
div id=3
/div

i want to get the ids of all the children of id 'top' and store it in an array in the order listed above. so final output in this case would be:

arr[0] = 1
arr[1] = 2
arr[2] = 3

is there a function or simple procedure that help me do this?

thanks.