Page "jumping" on link click

J

Jim

Hey guys
I have this page that uses a small script that changes the button image
when the button is clicked. The problem is that when clicked, the page
suddenly "jumps" to the top. I have purposly left dead links in the page
(the ones that "point" to the page the viewer is currently on). Is there
a way to stop this behaviour? Also, I have created a remote rollover
effect so that when the cursor is over a button, an image in another
location changes. But the image that is supposed to load, takes a while
to do so and the whole effect is ruined. The image size is logical but
is there any way to load them into the browsers cache in the background?
Thanks!

Jim
 
M

Matt Kruse

Jim said:
I have this page that uses a small script that changes the button
image when the button is clicked. The problem is that when clicked,
the page suddenly "jumps" to the top. I have purposly left dead links
in the page (the ones that "point" to the page the viewer is
currently on). Is there a way to stop this behaviour?

I assume you are using onClick in the <a> tag?
Make sure to return false.
<a href="whatever.html" onClick="func();return false;">link</a>

When reporting a problem, it's always helpful to include your exact code
example that is failing, or even better a link to the page itself.
The image size is logical but is there any way to load them
into the browsers cache in the background? Thanks!

Yes, look into any common image rollover script for how to create Image()
objects which will (hopefully) pre-cache your images.
 
R

Richard Cornford

Jim said:
I have this page that uses a small script that changes the button
image when the button is clicked. The problem is that when clicked,
the page suddenly "jumps" to the top.
<snip>

Failure to return false form the onclick event handler to cancel
navigation, combined with using "#" as an HREF (which is interpreted as
the URL of the top of the current page (usually)).

Richard.
 
J

Jim

Thanks for the tips Matt, I will follow your advice in the future
regarding the code. Just for the sake of it, the page url is this:
www.team-x.gr/products.htm
Thanks again!

Matt Kruse said the following on 06/03/04 16:40:
 
J

Jimmy

Oups, forgot to thank Richard for his advice. I just saw his post today.
Thanks guys
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top