1

I am trying to make a button, which when clicked show an other html document. But, I have no idea how to do it.

Random COSMOS
  • 250
  • 4
  • 13

1 Answers1

3

Just add an onclick event to the button:

<button onclick="location.href = 'anotherfile.html';" id="myButton" class="float-left submit-button" >Home</button>

or you should do like that:

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

<script type="text/javascript">
    document.getElementById("myButton").onclick = function () {
        location.href = "anotherfile.html";
    };
</script>

More Suggestions:

<a href='anotherfile.html'>Click here</a>
Sajid Ijaz
  • 172
  • 1
  • 1
  • 8