Use Javascript To Create A Button Link  

by Matt Hawkins, 07/02/2011
Categories : JavaScript

You can use Javascript to create a button that when pressed will provide a link to a specific URL.

Copy the following Javascript function into the Head of your HTML page :

<!-- Author : Matt Hawkins -->
<!-- Site : -->
<!-- Begin
function GoToURL(sURL) { window.location = sURL; }
// End -->

Then you can create a button link using this HTML :

<input type=button value="Button Link" onClick="GoToURL('');">

When the user clicks the button the GoToURL function is called. The page URL to link to is passed as a parameter and the javascript redirects the user to this page.

Author : Matt Hawkins  Last Edit By : Matt Hawkins
PHP Powered  MySQL Powered  Valid XHTML 1.0  Valid CSS  Firefox - Take Back The Web  EUKHost - Recommended Webhosting Solutions

MattHawkins CMS v3.0 - Copyright 2009-2022