onclick link code example

Example 1: href on a button

<button onclick="window.location.href='/page2'">Continue</button>

Example 2: html button link

<button><a href='https://google.com' alt='Broken Link'>This is a button</a></button>

Example 3: onclick href

onclick="location.href='http://www.hyperlinkcode.com/button-links.php'"

Example 4: onclick url

<button onclick="location.href='logout.php';">logout</button>

Example 5: link input button in php

<input type=button onClick="parent.location='index.html'" value='click here'>

Example 6: onclick go to url

<input type=button onClick="opener.location='https://www.plus2net.com/'" value='Make the Main window change'>
<input type=button onClick="opener.location='https://www.plus2net.com/html_tutorial/button-linking.php'" value='Bring the button linking tutorial again'>
<input type=button onClick="location='https://www.plus2net.com/'" value='Make the current  window change'>
<input type=button onClick="self.close();" value="Close this window">

Tags:

Html Example