Creating an HTML push button link

Using the source code below allows you to create a push button link. If you want the link to go to a web page other than Computer Hope, change the URL to the web page you want to open.

Tip: The code below is entered between the <body> and </body> HTML tags.

<INPUT Type="BUTTON" Value="Home Page" Onclick="window.location.href=''">

The Type attribute must be set to "BUTTON", which defines it as a clickable button on the webpage. The Value attribute sets the text displayed on the button itself. The Onclick attribute sets the action performed when the button is clicked. In this case, we want the button click to open the page defined after the "window.location.href=" code. The webpage address must be contained within single quotes as well.


Click the button below to see an example of how this code works.

Note: Some Internet browsers, like Internet Explorer, may block the code above from running, resulting in the button not working when clicked. A message similar to "Internet Explorer restricted this web page from running scripts or ActiveX controls" may appear at the bottom or top of the browser if blocked. A button titled Allow blocked content may be available to click. Clicking this button should allow the code to be executed and the button to work on your web page.

Additional information

  • See our push button definition for further information on this term and related links.