Solved

Add OnClick Event to a Form Action

Posted on 2012-03-28
1
227 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 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