Try using the CSS without any javascript.
Give your anchor tag a class selector like this:
<a class="anchor" id="top"></a>
Now, you can position the anchor tag an offset higher or lower than where it actually appears on the page, by making it a block element and relatively positioning it. Assigning top value as -250px will position the anchor up 250px.
a.anchor {
display: block;
position: relative;
top: -250px;
visibility: hidden;
}