473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How to open a new page onclick on submit button?

Is it possible to submit form:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="payPalForm" target="_new">


and have the submit button to open a new page at the same time?

I have tried onclick="location.href=.. yet form seems to have priority over onclick, any ideas?
Feb 10 '11 #1
3 3606
Dormilich
8,658 Expert Mod 8TB
if you don’t need the result, I think it’s possible, otherwise not.
Feb 10 '11 #2
clain
79
Write JS function function
Expand|Select|Wrap|Line Numbers
  1. function openWindow()
  2. {
  3.  window.open('new_page_address.html','_blank');
  4.  return true;
  5. }
  6.  
now the HTML
Expand|Select|Wrap|Line Numbers
  1. <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="payPalForm" onsubmit="return openWindow()">
Enjoy!!!
Feb 19 '11 #3
JKing
1,206 Expert 1GB
If you aren't using a strict doctype you can use the target attribute of the form.

Expand|Select|Wrap|Line Numbers
  1. <form action="" method ="" target="_blank" >
  2.  
This will work for all users even those with javascript disabled.
Feb 19 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Anna | last post by:
Hi all. I have a (hopefully) pretty simple question. I open a link in a new window: <a href="http://www.somewhere.com/some.hml"...
4
by: Jaz | last post by:
Is this how it's done? IE 6.0 after opening bigger.html in a new page, then shows the site directory contens in the main window. ?! The popup page bigger.html shows a larger pic of a product. In...
3
by: Alisson Vale | last post by:
Hello, An interesting feature on ASP.NET is to maintain the values for webcontrols after a submit action on the webform. Could I do that also with domain objects? Let´s see the context: My...
3
by: Russell | last post by:
I have a web page that i am using an image button as my submit button. The code behind the button works, but when I click enter on the web page, nothing happens. Can anybody tell me how to get my...
7
by: ACaunter | last post by:
Hi all, I'm having a little problem here.. my code is: Session("test") = Button46.Text Button46.Attributes.Add("Onclick", "opennewpage()") i have this code inside the button click, which means...
3
by: leos1981 | last post by:
I am currently working on the asp.net web project. I using the return false method to stop the submit action when the user choose to cancel the action. It is working fine before I am installing the...
2
by: miyagikarate | last post by:
On all of my webpage which require a submit action, the forms just reload as if nothing happened. I wrote a simple test code and I still can't get the form to work. I know they just stopped working...
8
dnb
by: dnb | last post by:
Hi Friends, i learn a phpso plz help me. i want to call a php fundtion on a onclick event of html submit button this function is work properly but i don't know how to call it on a onclick event...
3
by: webster5u | last post by:
Hi, i have a question about JavaScript. When we click a submit button from the form with multi-submit button. Can JavaScript detect which submit button has been submit? I make a form with 3 submit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.