How to create a link with html button that go the same page but different div


 Html  Code :

And the goal division is myDIV :


<!DOCTYPE html>
<html>
<head>
    <title>Link with same page but different DIV</title>


<script type="text/javascript">
    function myFunction() {
        document.getElementById("myDIV").scrollIntoView(true);
    }
    </script>
</head>
<body>

<button onclick="myFunction()">Click Me</button>


<div id="myDIV">
        <h1>Md. Alamgir Hossain</h1>
        <h1>Dept. of Computer Science & Engineering</h1>
        <h1>Jessore University of Science & Technology</h1>
        <h1>You Tube</h1>
    </div>
</body>
</html>

1 comment: