Answers for "html redirect to another page on button click"

48

redirect javascript

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
Posted by: Guest on May-14-2020
7

js onclick redirect

<button onclick="location.href='www.yoursite.com'">Click Me</button>
Posted by: Guest on June-16-2020
4

how to open a new html page on button click in javascript

<button id="myButton" class="float-left submit-button" >Home</button>

<script type="text/javascript">
    document.getElementById("myButton").onclick = function () {
        location.href = "www.yoursite.com";
    };
</script>
Posted by: Guest on April-29-2020

Code answers related to "html redirect to another page on button click"

Code answers related to "Javascript"

Browse Popular Code Answers by Language