Creating a Button with a Hyperlink

Description

There are two ways to create a button with a hyperlink.

  • with a form, which will work in all circumstances

  • with JavaScript, which requires that the user have JavaScript enabled

Form Solution

The following HTML code creates a button with the label "Click Here to Continue". When clicked the hyperlink opens nextpage.a5w in the current window.

<html>
<head>
<meta name="generator" content="Alpha Anywhere HTML Editor">
<title></title>
</head>
<body>
<form action="nextpage.a5w">
<input type="submit" value="Click Here to Continue">
</form>
</body></html>

JavaScript Solution

The following JavaScript code creates a button with the label "Click Here to Continue". When clicked the hyperlink opens nextpage.a5w in the current window.

<html>
<head>
<meta name="generator" content="Alpha Anywhere HTML Editor">
<title></title>
</head>
<body>
<input name="continue" type="button" id="continue" value="Click Here to Continue" onclick="window.location='nextpage.a5w'"> 
</body></html>

The Resulting Page

In both cases the resulting page looks like this.

images/WPT_Button_wi_Hyperlink_2.gif