Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add OnClick Event to a Form Action

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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

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. …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

664 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