Button Onclick Go To Different Page Code Example


Example 1: js onclick redirect

<button onclick="location.href='www.yoursite.com'">Click Me</button>

Example 2: 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>

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable