Click to See Complete Forum and Search --> : table cells resizing unexpectedly


cflynn
08-08-2003, 02:30 AM
Hi. I'm just wondering if anyone can give me any ideas about why the following code would resize the table cell height only on IE5/Mac, making the cell taller than 30px, pushing the entire contents down on the page.

The javascript function place in the head:

function clearChose(theSelect) {
//check if option has been stripped already
if (theSelect.options[0].value == 0) {
if (theSelect.options[theSelect.selectedIndex].value != 0) {
var n2 = theSelect.selectedIndex;
var optLen = theSelect.length;
for (var loop = 0; loop < (optLen-1); loop++) {
theSelect.options[loop].value = theSelect.options[loop+1].value; //strip off the first option value
theSelect.options[loop].text = theSelect.options[loop+1].text;//strip off the first option text
}
theSelect.length-=1; //set to right length
theSelect.selectedIndex=n2-1; //set the selected value
}
}
}

The html code placed in the body:

<tr>
<td style="height:30px">
<div align="right">Hand:</div>
</td>
<td>
<select name="Hand" onChange="clearChose(document.form2.elements['Hand']);">
<option value="0">Choose One</option>
<option value="Left Hand">Left Hand</option>
<option value="Right Hand">Right Hand</option>
</select>
</td>
</tr>

Any thoughts would be much appreciated.

Charles
08-08-2003, 05:17 AM
The problem is that you are using TABLEs for layout which you ought not to be doing. From the HTML 4.01 Specification:
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.
http://www.w3.org/TR/html4/struct/tables.html#h-11.1

cflynn
08-08-2003, 02:18 PM
Yes, that would be optimal, but I didn't do the design. I'm doing a database and scripting for a client and I don't really want to rework the whole site for just one browser.

Thanks for the link.

Any other ideas about why this script would not be working on IE5 on Mac?

Thanks.

Charles
08-08-2003, 02:24 PM
It's more than one browser, it's all the audio and Braille browsers out here. If your client is in the US tell them about the ADA and charge them a bundle to bring the site up to code.