I have a page with lots of contents, I want to put a hyperlink in the top, that scrolls the page to a div
.
this is my code :
<a id = "show" class="show" href="#" onclick="return toggleOptions(this);"><h2>FIRST BUTTON</h2></a>
<div id="toggleOptions" class="toggleOptions"> // this is div which is somewhere in center of page
text text text....
more text text....
text text.........
</div>
I know that I need to use JavaScript, something like that:
<script type='text/javascript'>
window.location = "/index.php#myDiv";
</script>
Just don't know how to do It correctly. Please help me .