Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: Re: Modify Element Tag Question Date: Sat, 12 May 2012 18:08:30 -0600 Lines: 82 Message-ID: References: X-Trace: individual.net rHa9s9vmaqldUbpz752YJQy/s/VdAMQQHTKwupwnjMEHnUojX7Sp4clSqPgqjCLmXl Cancel-Lock: sha1:59/Deo0t6k05jQiMacyUR37vvuc= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: csiph.com comp.lang.javascript:13888 Dr John said: > > Ersatz tags will annoy a validator. Why not use ? Or use a > class on the TD elements, and toggle it between one meaning bold and one > not meaning anything? > > OTOH, would serve? For me, it does not alter the font; but the > tested (FF 12) following, which alters the background, may serve. > > > > > >
123
456
789
> To change columns, one needs only alter two entries in the DOM tree, > which should be possible. > > You could class every element in the table with "X" + its row column > number, and alter the classes as needed. > Dr John (and the others): My phone book has two visible columns. Each column has 307 cells. Each cell has 3 rows Each of the rows contains 5 elements for each of the visible columns. When the user 'clicks' a sorting button (for Name, for street address, or for Lot No.), then the following javascript function is called: It is this next function that I would like to add (bolding/unbolding) code to Denis McMahon is the original designer of this fone book. (and I made several mods over the last year) Thanks, -Mel Smith ******************** one of the fone book table functions below // build the table from the sorted data function rebuildTable() { var theTable, theCells, i, r, baseRow; theTable = document.getElementById("theTable"); for (i = 0; i < allData.length; i = i + 2) { baseRow = 2 + (4 * (i / 2)); // first 2 rows are header & spacer, then 4 rows for each 2 data records // left side data is allData[i]; // right side data is allData[i+1]; for (r = 0; r < 3; r = r + 1) { // don't worry about spacer rows, just do data rows 0, 1, 2 theCells = theTable.rows[baseRow + r].cells; if (r === 0) { theCells[0].innerHTML = allData[i].memName; // would like to test 'unbolding' here when address below is bolded theCells[1].innerHTML = allData[i].editButt; theCells[3].innerHTML = allData[i + 1].memName; theCells[4].innerHTML = allData[i + 1].editButt; } else if (r === 1) { theCells[0].innerHTML = ""+allData[i].localAddr+""; // testing bolding here theCells[1].innerHTML = allData[i].lotNum; theCells[2].innerHTML = allData[i].localTel; theCells[4].innerHTML = ""+allData[i + 1].localAddr+""; theCells[5].innerHTML = allData[i + 1].lotNum; theCells[6].innerHTML = allData[i + 1].localTel; } else if (r === 2) { theCells[0].innerHTML = allData[i].otherAddr; theCells[1].innerHTML = allData[i].otherTel; theCells[3].innerHTML = allData[i + 1].otherAddr; theCells[4].innerHTML = allData[i + 1].otherTel; } } } }