> I have a page with multiple tables, some of which have the class
> "ClassA".
> I need to identify the widest table whose class is ClassA.
> The following JavaScript code returns the table width
> ("thisTableWidth")
> when run in FireFox 2.0, but returns '0' when run in IE6.
> Be grateful for any advice for how to get at this value using IE6.
> Thanks
> Griff
> -----------------------------
> var thisTableWidth = 0;
> var maxTableWidth = 0;
> // Get collection of tables
> var eachObject = document.getElementsByTagName("table");
> // Iterate through each table
> for (var i = 0; i < eachObject.length; i++)
> {
> // Does this table have a class called ClassA?
> if (eachObject[i].className.indexOf('ClassA') != -1)
> {
> // Attempt to read this table's width
> thisTableWidth = eachObject[i].offsetWidth;
> // Is this wider than my last table I checked?
> if (thisTableWidth > maxTableWidth)
> {
> maxTableWidth = thisTableWidth;
> }
> }
> }
> -----------------------------
> PS - also posted to [microsoft.public.scripting.jscript]