"rodchar" <rodchar@discus sions.microsoft .comwrote in message
news:382C4C64-3F28-469C-874B-DB9B54785B1A@mi crosoft.com...
hey all,
is there a way to delete or remove and item from the results of
getElementsByTa gName?
>
Its not entirely clear what you actually want to do.
If you mean you want to take the list of items returned by
getElementsByTa gName and remove an item from that list then:-
no you can't do that directly. You can copy the list into an array skipping
any that do not conform to come criteria:-
function filterNodeSet(n odeSet, callback)
{
var resultSet = new Array()
for (var i = 0, length = list.length; i < length; i++)
if (callback(nodeS et[i])) resultSet.push( nodeSet[i])
}
var newSet = filterNodeSet(o ldSet, function(node) {
return <boolean expression using node here>
})
If you mean can you delete from the DOM a node found via
getElementsByTa gName then yes:-
thank you it was the 1st one but thank you for covering both,
rod.
"Anthony Jones" wrote:
"rodchar" <rodchar@discus sions.microsoft .comwrote in message
news:382C4C64-3F28-469C-874B-DB9B54785B1A@mi crosoft.com...
hey all,
is there a way to delete or remove and item from the results of
getElementsByTa gName?
>
>
Its not entirely clear what you actually want to do.
>
If you mean you want to take the list of items returned by
getElementsByTa gName and remove an item from that list then:-
>
no you can't do that directly. You can copy the list into an array skipping
any that do not conform to come criteria:-
>
function filterNodeSet(n odeSet, callback)
{
var resultSet = new Array()
for (var i = 0, length = list.length; i < length; i++)
if (callback(nodeS et[i])) resultSet.push( nodeSet[i])
}
>
>
var newSet = filterNodeSet(o ldSet, function(node) {
return <boolean expression using node here>
})
>
>
If you mean can you delete from the DOM a node found via
getElementsByTa gName then yes:-
>
nodeSet[i].parentNode.rem oveChild(nodeSe t[i])
>
>
>
--
Anthony Jones - MVP ASP/ASP.NET
>
>
>
Comment