Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-03-2008, 07:04 PM   PM User | #1
Jacobb123
Regular Coder

 
Join Date: Aug 2006
Posts: 311
Thanks: 0
Thanked 1 Time in 1 Post
Jacobb123 has a little shameless behaviour in the past
Help with simple onclick event

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

Code:
<button onclick="location.replace("http://google.com");">Cancel</button>
Jacobb123 is offline   Reply With Quote
Old 01-04-2008, 07:36 AM   PM User | #2
arilia
New Coder

 
Join Date: Dec 2007
Posts: 14
Thanks: 0
Thanked 5 Times in 5 Posts
arilia is an unknown quantity at this point
onclick ="document.my_form.submit()"

where my_form is the name of the form

(But why don't you use a submit button???)
arilia is offline   Reply With Quote
Old 01-04-2008, 08:19 AM   PM User | #3
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
<input type = "button" value = "Cancel" onclick="window.location = 'http://google.com'">
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:17 AM.


Advertisement
Log in to turn off these ads.