bad code

Today I replaced this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<tr>
  <td height="1">
    <table width="347" height="1" border="0" cellpadding="0" cellspacing="0" background="CCorner/images/dot_hor.gif">
      <tr>
        <td width="347" height="1"><img src="images/en/spacer.gif" width="1" height="1"/></td>
      </tr>
    </table>
  </td>
  <td>
    <table width="1" height="22" border="0" cellpadding="0" cellspacing="0" background="CCorner/images/dot_vert.gif">
      <tr>
        <td width="1" height="22"><img src="images/en/spacer.gif" width="1" height="1" alt=""/></td>
      </tr>
    </table>
  </td>
</tr>

<tr> <td height="1"> <table width="347" height="1" border="0" cellpadding="0" cellspacing="0" background="CCorner/images/dot_hor.gif"> <tr> <td width="347" height="1"><img src="images/en/spacer.gif" width="1" height="1"/></td> </tr> </table> </td> <td> <table width="1" height="22" border="0" cellpadding="0" cellspacing="0" background="CCorner/images/dot_vert.gif"> <tr> <td width="1" height="22"><img src="images/en/spacer.gif" width="1" height="1" alt=""/></td> </tr> </table> </td> </tr>

with this:

1
2
3
4
5
6
<tr>
  <td height="1" width="347" style="background:url(CCorner/images/dot_hor.gif)"></td>
</tr>
<tr>
  <td width="1" height="22" style="background:url(../CCorner/images/dot_vert.gif)"></td>
</tr>

<tr> <td height="1" width="347" style="background:url(CCorner/images/dot_hor.gif)"></td> </tr> <tr> <td width="1" height="22" style="background:url(../CCorner/images/dot_vert.gif)"></td> </tr>

But I still feel icky.

More sortable tables

That script again. I needed to be able to trigger a sort onload. Posted this to the aforementioned blog as well, but I’ll keep it here for myself.

1
2
3
4
5
6
7
8
9
10
11
12
//this function is passed the ID of one of the TH elements, and triggers a sort without a click
function trigger_Sort(id) {
	var fakeEvent=new Object;
	fakeEvent.currentTarget=document.getElementById(id).firstChild;
//comment out this block for ascending sort
	for (var i=0; i<fakeevent .currentTarget.childNodes.length; i++) {
		if (fakeEvent.currentTarget.childNodes[i].tagName) {
			fakeEvent.currentTarget.childNodes[i].setAttribute('sortdir','down');
		}
	}
	ts_resortTable(fakeEvent);
}

//this function is passed the ID of one of the TH elements, and triggers a sort without a click function trigger_Sort(id) { var fakeEvent=new Object; fakeEvent.currentTarget=document.getElementById(id).firstChild; //comment out this block for ascending sort for (var i=0; i<fakeevent .currentTarget.childNodes.length; i++) { if (fakeEvent.currentTarget.childNodes[i].tagName) { fakeEvent.currentTarget.childNodes[i].setAttribute('sortdir','down'); } } ts_resortTable(fakeEvent); }