put this function behind a button not a link

Posted on 2011-09-08
Last Modified: 2012-05-12
I got this javascript that creates a link,however I need it to place behind button for consistency of design.

<a href="javascript: history.go(-1)">Cancel</a>
Question by:zachvaldez
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
LVL 13

Accepted Solution

haloexpertsexchange earned 100 total points
ID: 36503290
you should be able to place a button in the href like this or do an onclick on the button
<a href="javascript: history.go(-1)"><input type="button" value = "Cancel"></a>
<input type="button" value="Cancel" onClick="javascript: history.go(-1)">

Open in new window

LVL 40

Assisted Solution

gurvinder372 earned 100 total points
ID: 36503294
<input type="button" onclick="history.go(-1)" value="Cancel"/>

Author Comment

ID: 36514121
Does it matter if my other button is server side?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 40

Expert Comment

ID: 36515810
did you tried the code?
LVL 13

Expert Comment

ID: 36522718
it should not matter if the other button is server side.

Author Comment

ID: 36527102
That was exactly true. I would equally share the points if I can redo the point allocation again.That was my error and I regret for it. Halo's answer was correct to.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How Close unsubmited attempts 10 47
disadvantage of code behind appoarch in 3 30
null, truthy, falsey confusion 25 33
center navbar (navigation menu) on web page 3 23
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question