W
Ward Germonpré
Hi,
On a html page I have a Table called "resultaattbl", generated using dom-
methods and an array of jsobjects. The rows below the columnheader have a
class called "normaal". This is the layout:
...
<tr class=normaal>
<td><td>
<td><a href><img outlook-icon /></a>
<td>this text I want to alert!</td>
<td>...
</tr>
<tr class=normaal>
...
In the code below I try to alert the third cell of every row of my table,
but I get 'null' as value. Replacing nodeValue with textContent yields
the complete rowcontent, so I must be pretty close!
mijnfilter=function(node) {
if (node.className=="gewoon" )
return NodeFilter.FILTER_ACCEPT
else
return NodeFilter.FILTER_SKIP
}
var rootnode=document.getElementById("resultaattbl")
var walker=document.createTreeWalker(rootnode,
NodeFilter.SHOW_ELEMENT,mijnfilter,false)
do {
walker.firstChild(); //(now it points at the first TD, right ?
walker.nextSibling(); //(now it points at the second TD, right ?
walker.nextSibling(); //(now it points at the third TD, right ?
alert(walker.currentNode.nodeValue); //so why is this 'null' ?
} while (walker.nextNode())
thx for any help
Ward
On a html page I have a Table called "resultaattbl", generated using dom-
methods and an array of jsobjects. The rows below the columnheader have a
class called "normaal". This is the layout:
...
<tr class=normaal>
<td><td>
<td><a href><img outlook-icon /></a>
<td>this text I want to alert!</td>
<td>...
</tr>
<tr class=normaal>
...
In the code below I try to alert the third cell of every row of my table,
but I get 'null' as value. Replacing nodeValue with textContent yields
the complete rowcontent, so I must be pretty close!
mijnfilter=function(node) {
if (node.className=="gewoon" )
return NodeFilter.FILTER_ACCEPT
else
return NodeFilter.FILTER_SKIP
}
var rootnode=document.getElementById("resultaattbl")
var walker=document.createTreeWalker(rootnode,
NodeFilter.SHOW_ELEMENT,mijnfilter,false)
do {
walker.firstChild(); //(now it points at the first TD, right ?
walker.nextSibling(); //(now it points at the second TD, right ?
walker.nextSibling(); //(now it points at the third TD, right ?
alert(walker.currentNode.nodeValue); //so why is this 'null' ?
} while (walker.nextNode())
thx for any help
Ward