The displaytag table is easily traversed using the DOM, why do we need
id's on each cell?

Here's an example where every row is given a highlight.  You could
easily modify this to grab <td>'s and do whatever you want with them:

    var previousClass = null;
    // simple script for highlighting rows
    var table = document.getElementsByTagName("table")[0];
    var rows = table.getElementsByTagName("tr");
    for (i=3; i < rows.length; i++) {
        rows[i].onmouseover = function() {
previousClass=this.className;this.className='tableRowOver' };
        rows[i].onmouseout = function() { this.className=previousClass
};
        rows[i].onclick = function() {
            var cell = this.getElementsByTagName("td")[0];
            var link = cell.firstChild;
            var href = link.getAttribute("href");                
            var id = href.substring(href.indexOf("id=")+3, href.length);

 
location.href="<%=request.getContextPath()+editURL.getPath()+"&from=list
"%>&id="+id;
            this.style.cursor="wait";
        }
    }

HTH,

Matt

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John
Dang
Sent: Thursday, August 14, 2003 9:28 AM
To: [EMAIL PROTECTED]
Subject: [displaytag-user] Adding html id to table cells


Dear DisplayTag Builder,

Are there any way to add html id for each cell in display table? I
really want to use javascript to get the values from those cells.

Regards

John



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01
/01
_______________________________________________
displaytag-user mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to