Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Script not behaving as needed
September 7, 2006, 12:06 am
rate this thread
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
var el = document.getElementById(theId)
el.style.display="block"; //show element
el.style.display="none"; //hide element
<table><tr><td width=790 height="1000" valign="top">Some
<a href="#" onClick = showAndHide('Title')><img
src="graphics/picture_heading.gif" alt="Picture Heading" height=30
<div id='Title' style="display:none">
- Jonathan N. Little
September 7, 2006, 2:36 pm
Re: Script not behaving as needed
This is your problem the URL to nowhere! And you onclick handler should
be put in quotes. You have 2 options I can see,
1) Have showAndHide() return false to cancel the link's click but if
the page, or better:
2) Put a real location in the HREF! Give you link an ID and use it as an
anchor for the HREF.
<a id="StayHere" href="#StayHere" onclick="showAndHide('Title')">...
happens, but at least thay won't just to the top of the page.
A far BETTER solution IMO is to have NO link and have 'Title' displayed
the 'showAndHide()' function to the IMG and set 'Title' display to none.
but does not interfere when they don't!
LITTLE WORKS STUDIO