Solved

Add OnClick Event to a Form Action

Posted on 2012-03-28
1
228 Views
Last Modified: 2016-03-24
Is there a way to add an OnClick event to a form action?  When you click submit on my form it takes you to paypal, but I want it to open in a new window that I can set to a specific size.

Any Clues?  Thanks in advance Y'all!
0
Comment
Question by:rgranlund
[X]
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
1 Comment
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 300 total points
ID: 37777299
Refer here:-
http://www.codebelt.com/jquery/open-new-browser-window-with-jquery-custom-size/

<script type="text/javascript">
    //Created an array to hold onto the desired info.
    var windowSizeArray = [ "width=200,height=200",
                            "width=300,height=400,scrollbars=yes" ];
 
    $(document).ready(function(){
        //Links that has the ".newWindow" class will call this script.
        $('.newWindow').click(function (event){
 
            // Gets the URL from the clicked link.
            var url = $(this).attr("href");
 
            /*Gets the name from the clicked link. Currently I commented out the
              jquery script and just put "popUp" for a default name because I didn't
              include the name in the links.*/
            var windowName = "popUp";//$(this).attr("name");
 
            /*Places the string from the array into the windowSize variable.
              The array slot is determined by the "rel" number on the link.*/
            var windowSize = windowSizeArray[  $(this).attr("rel")  ];
 
            //This method opens a new browser window.
            window.open(url, windowName, windowSize);
 
            /*Prevents the browser from executing the default action and
              allows us to use the "window.open" within our script.*/
            event.preventDefault();
 
        });
    });
</script>

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

749 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