Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a quickie button question

Status
Not open for further replies.

benluke4

Technical User
Jan 27, 2005
127
GB
How do i make this button a link to say hello.html

<input type="button" name="add2" value="New Location">

thanks

Ben.

 
These should work
Code:
<input type="button" name="add2" value="New Location" onclick = "location.href='hello.html'">
or
Code:
<input type="button" name="add2" value="New Location" onclick = "document.location='hello.html'">

Glen
 
Consider that is not the best way to do it. Users without javascript and internet search engines won't be able to surf your site. If you want the link to look like a button, you could do that with css and still have the regular <a> element which would work everywhere.
 
ok thanks, i think ill use css,.

cheers glenmac

cheers Vragabond
 
Try this code I once concocted for a link to look like a button:
Code:
<style type="text/css">
a:link,
a:visited {
	display: block;
	float: left;
	margin: 2px 5px 2px 5px;
	padding: 2px;
	width: 100px;
	border-top: 1px solid #cccccc;
	border-bottom: 1px solid black;
	border-left: 1px solid #cccccc;
	border-right: 1px solid black;
	background: #cccccc;
	text-align: center;
	text-decoration: none;
	font: normal 10px Arial;
	color: black;
}

a:hover { background: #eeeeee; }

a:active { 
	border-bottom: 1px solid #eeeeee;
	border-top: 1px solid black;
	border-right: 1px solid #eeeeee;
	border-left: 1px solid black;
}
</style>

<a href="#">The Button Link</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top