hasRegistered is a recursive function to go through until it gets to a text node (nodeType == 3). Once it finds one, it evaluates if the text is the correct text, in this case "Registered". At function return if it is true it adds the CSS class registered to the row, allowing me to apply certain CSS values to it. This javascript also retains any other class names, thus allowing it to maintain the even and odd row stylings from the actual displaytag code.
good luck
<code language="javascript">
function stylizeRegistered(tableId) {
var table = document.getElementById(tableId);
var tbody = table.getElementsByTagName("tbody")[0];
var rows = tbody.getElementsByTagName("tr");
for (iter=0; iter<rows.length; iter++) {
var anchorcells = rows[iter].getElementsByTagName("a");
for (jiter=0;jiter<anchorcells.length;jiter++) {
if (hasRegistered(anchorcells[jiter])) {
// alert("h"+jiter);
rows[iter].className = rows[iter].className+' registered';
}
}
}
}
function trim(s) {
while (s.substring(0,1) == ' ') {
s = s.substring(1,s.length);
}
while (s.substring(s.length-1,s.length) == ' ') {
s = s.substring(0,s.length-1);
}
return s;
}
function hasRegistered(current) {
if (current.nodeType == 3) { //if is a text node
nv = current.nodeValue;
if (trim(nv) == "Registered")
return true;
else return false;
}
else if (current.hasChildNodes) {
var reg = false;
for (j=0;j<current.childNodes.length;j++) {
reg = reg || hasRegistered(current.childNodes[j]);
}
return reg;
} else { //at an end point that is not a text node
return false;
}
}
</code>
Christopher Williams
____________________________________________
Product Manager
Cryptek, Inc.
[address]
1501 Moran Road
Sterling, VA 20166
[web]
url: www.cryptek.com
aim: cryptekdcpm
On Feb 27, 2005, at 3:55 PM, SourceForge.net wrote:
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=3019741
By: iyadurai
Could you please share the solution? My email address is
[EMAIL PROTECTED]
�
Thanks
Pradeep
______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=249318
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

