useJquery-1.4.4.min.js:

<script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>

Top.js:

$(document).ready(function () {

var show_delay;

var scroll_left = parseInt((document.body.offsetWidth - 960) / 2) + 961;

$(".scroll").click(function () {

document.documentElement.scrollTop = 0;

document.body.scrollTop = 0;

});

$(window).resize(function () {

scroll_left = parseInt((document.body.offsetWidth - 960) / 2) + 961;

$(".scroll").css("left", scroll_left);

}); reshow(scroll_left, show_delay);

});

function reshow(marign_l, show_d) {

$(".scroll").css("left", marign_l);

if ((document.documentElement.scrollTop + document.body.scrollTop) != 0) {

$(".scroll").css("display", "block");

}

else { $(".scroll").css("display", "none"); }

if (show_d) window.clearTimeout(show_d);

show_d = setTimeout("reshow()", 500); }


CSS:

<style type="text/css">

.scroll{ bottom:100px;cursor:pointer; text-align:center;

height:35px;width:35px;position:fixed;

border:2px solid black; background-color:#dab766;}

</style>

Html:

<p>there is top....</p>

<div style=" height:980px;"></div>

<div class="scroll">Top</div>