Javascript - Browser skips back to top of page on image change
<p>I have some simple code to replace an image src.  It is working correctly but everytime the image is updated, the browser skips right back to the top of the page.</p>

<p>I have several image tags in my page.  All of which hidden, except for the first one.  The script just iterates through them and uses the src attribute to update the first image.</p>

<p>Here is the code I am using:</p>

<pre><code>var j = jQuery.noConflict();  
var count = 1;
var img;

function update_main_image()
{   
    count++;   

    if (j('#main_image_picture_'+count).length &gt; 0)
    {   
        img = j('#main_image_picture_'+count).attr('src');
    }
    else
    {   
        count = 1;   
        img = j('#main_image_picture_'+count).attr('src');   
    }    

   j(".main_image_picture_auto").fadeOut(1500, function() { 
       j(this).fadeIn(); 
       j(this).attr("src", img);   
    });       
}


j(document).ready(function()
{
    setInterval(update_main_image, 6000);    
});
</code></pre>

<p>Any ideas what might be causing it?
Any advice appreciated.</p>

<p>Thanks.</p>
