the penguin
07-16-2010, 01:58 PM
Hello, I'm using the below code to toggle show / hide a table row, but firefox is ignoring the colspan="2". Perhaps someone can help me in altering the javascript. I appreciate the help!
SCRIPT:
<script>
function toggle(el) {
if(typeof(el) == 'string')
el = document.getElementById(el);
var img = document.getElementById(el.id + '_img');
switch(el.style.display) {
case 'none' :
img.src = 'icon_minus.gif';
el.style.display = 'block';
break;
case 'block' :
img.src = 'icon_plus.gif';
el.style.display = 'none';
break;
default:
img.src = 'icon_minus.gif';
el.style.display = 'block';
break;
}
}
</script>
HTML:
<table>
<tr>
<td>Email Address</td>
<td>aaaaaaa@aa.com <img src="icon_plus.gif" border="0" id="1_img" /> <a href="javascript:toggle('1')">Change email address</a></td>
</tr>
<tr style="display:none;background-color:#DDE1EA;" id="1">
<td colspan="2">data to change email address</td>
</tr>
</table>
SCRIPT:
<script>
function toggle(el) {
if(typeof(el) == 'string')
el = document.getElementById(el);
var img = document.getElementById(el.id + '_img');
switch(el.style.display) {
case 'none' :
img.src = 'icon_minus.gif';
el.style.display = 'block';
break;
case 'block' :
img.src = 'icon_plus.gif';
el.style.display = 'none';
break;
default:
img.src = 'icon_minus.gif';
el.style.display = 'block';
break;
}
}
</script>
HTML:
<table>
<tr>
<td>Email Address</td>
<td>aaaaaaa@aa.com <img src="icon_plus.gif" border="0" id="1_img" /> <a href="javascript:toggle('1')">Change email address</a></td>
</tr>
<tr style="display:none;background-color:#DDE1EA;" id="1">
<td colspan="2">data to change email address</td>
</tr>
</table>