Closed Bug 1296 Opened 26 years ago Closed 26 years ago

Changing styles on table cells via DOM seems to remove table borders

Categories

(Core :: Layout: Tables, defect, P2)

x86
Other
defect

Tracking

()

VERIFIED DUPLICATE of bug 1295

People

(Reporter: angus, Assigned: buster)

Details

I think there's something funky going on with the CSS OM code and borders.

Here's some sample code:

<html>
<head>
<script>
var selectedCell = null;

function select(e) {
  if (selectedCell) {
    selectedCell.style.backgroundColor="white";
    selectedCell.style.color="black";
  }
  selectedCell = this;
  this.style.backgroundColor="blue";
  this.style.color="white";
}

function init() {
  var cells = document.getElementsByTagName("TD");
  for (var i=0; i<cells.length; i++) {
    cells[i].onmousedown=select;
  }
}
</script>
</head>
<body onload="init()">
<table id="mytable" border=1 cellspacing=3 cellpadding=10>
<tr>
<td>Apples</td>
<td>Oranges</td>
<td>Peaches</td>
</tr>
<tr>
<td>Guitar</td>
<td>Violin</td>
<td>Bass</td>
</tr>
<tr>
<td>Basketball</td>
<td>Baseball</td>
<td>Football</td>
</tr>
</table>
</body>


As you click on each cell, it should look "selected." Unfortunately, when I do
this, the borders for the individual cells disappear as well, as though I were
making a style declaration like:

this.style.border="none";

Which I am not. Weird, huh? Not sure if this is tables or DOM or what...
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → DUPLICATE
Ack! Internet exploder (which I've been testing) made me resubmit the damn
form. Screw IE. Marking as duplicate.

*** This bug has been marked as a duplicate of 1295 ***
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.