Jump to content

main page moves to the top on ajax reload


neilh

Recommended Posts

Hello, I have a live stats box on my website which reloads every 6 seconds. Here's the code for the bit which does this,

// Page Load Events
function livestats() {
MyAjaxRequest('onlinestats_ajax','/onlinestats.php');
setTimeout(livestats,6000);
}
function pageLoad() {
livestats();	
}

the pageLoad() function is called in the body tag when the main page loads, and then the DIV which the ajax is loaded into shows the content.

However if you have scrolled down the page after 6 seconds the page goes back up to the top. Now i can't work out why this is happening.

If you want to see the Ajax JS file then here it is -> http://phptut.jungledog.co.uk/themes/default/ajax.js

If you can help me sort this out it would be most appreciated!

 

Thanks,

Neil

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.