Posted by SHC on 10/16/92 11:57
I've put together the script below to show and hide content when an
image is clicked. However, when it is clicked the screen jumps to the
top of the page, rather than remaining with the image. Can anyone help
please.
Thanks
SHC
<html>
<head>
<script language="JavaScript">
function showAndHide(theId)
{
var el = document.getElementById(theId)
if (el.style.display=="none")
{
el.style.display="block"; //show element
}
else
{
el.style.display="none"; //hide element
}
}
</script>
</head>
<body>
<table><tr><td width=790 height="1000" valign="top">Some
Content</td></tr></table>
<table><tr>
<td valign="top">
<a href="#" onClick = showAndHide('Title')><img
src="graphics/picture_heading.gif" alt="Picture Heading" height=30
width=400 border="0"></a>
<div id='Title' style="display:none">
<p>Text</p></div></td></tr>
</table>
</body>
</html>
[Back to original message]
|