Info : Perhatikan attribute id
<html>
<head>
</head>
<body>
<a href="javascript:void(0);" onclick="jumpLink('targetID')">
Loncat ke ID = targetID
</a>
<a href="javascript:void(0);" onclick="jumpLink('apasajalah')">
Loncat ke ID = apasajalah
</a>
<p class=break></p>
<div id="targetID">DEMO 1</div>
<p class=break></p>
<div id="apasajalah">DEMO 2</div>
<p class=break></p>
<!-- ini js nya -->
<script>
//<![CDATA[
function jumpLink(ID){
var t = document.getElementById(ID).offsetTop;
window.scrollTo(0,t);
}
//]]>
</script>
</body>
</html>
a {
margin : 5px;
color : red;
}
.break {
height : 1500px;
background : beige;
border : 1px solid silver;
}
//javascript