View Full Version : Help with simple onclick event

01-03-2008, 08:04 PM
I am trying to redirect a user a different page when a button is clicked but instead of redirecting like I want it submits the form. Can someone tell me the correct way to do this?

here is my code

<button onclick="location.replace("http://google.com");">Cancel</button>

01-04-2008, 08:36 AM
onclick ="document.my_form.submit()"

where my_form is the name of the form

(But why don't you use a submit button???)

Philip M
01-04-2008, 09:19 AM
<input type = "button" value = "Cancel" onclick="window.location = 'http://google.com'">