Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add OnClick Event to a Form Action

Posted on 2012-03-28
1
Medium Priority
?
233 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 1200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

876 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