Lo mejor es no usar el id en este caso (no siempre conviene referenciar usando id). Una alternativa:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<script type="text/javascript">
function shToggle(obj) {
if (obj.nextSibling.style.display == "none")
obj.nextSibling.style.display = "block"
else
obj.nextSibling.style.display = "none"
}
</script>
</head>
<body>
<table>
<tr>
<td>
<a href="javascript:void(0);" onclick="shToggle(this); return false;">[Mostrar|Ocultar]</a><div id="id1" style="display:none;">contenido</div>
</td>
</tr>
<tr>
<td>
<a href="javascript:void(0);" onclick="shToggle(this); return false;">[Mostrar|Ocultar]</a><div id="id2" style="display:none;">contenido</div>
</td>
</tr>
</table>
</body>
</html>