thanks,
rodchar
Are we talking javascript here?
-Darrel
// generic dom walker
function domWalk(node,func)
{
var nodes = new Array();
if (func(node)) nodes[nodes.length] = node;
for (var i=0; i < node.childNodes.length; ++i)
{
nodes = nodes.concat(domWalk(node.childNodes[i],func));
}
return nodes;
}
// list of all elements whith 'mystring' in id
var list = domWalk(document.documentElement,function(n)
{
return (n.id && n.id.indexOf('mystring') != -1);
});
}
-- bruce (sqlwork.com)
That is a decent method. However, you might want to consider a
'getElementByClassName' function, in which case you could then 'tag' every
element with a class name and not have to deal with parsing the string.
-Darrel
> // list of all elements whith 'mystring' in id
> var list = domWalk(document.documentElement,function(n)
> {
> return (n.id && n.id.indexOf('mystring') != -1);
> });
i tried putting it right after the function but that doesn't seem to be
working for me.