Problem with button

Discussion in 'HTML' started by stax, Mar 22, 2007.

  1. stax

    stax Guest

    Hello,
    a PayPal button is typically a image, is it possible to use a real button?

    thx
    stax

    This is the typical markup:

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="">
    <input type="hidden" name="item_name" value="StaxRip donation">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="currency_code" value="EUR">
    <input type="hidden" name="tax" value="0">
    <input type="hidden" name="bn" value="PP-DonationsBF">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit">
    <img border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1">
    </form>

    Below is my real button attempt, I should mention I'm pretty clueless about web tech. It has two problems, first IE7 shows a warning about scripting and second it does not work.

    <script language="JavaScript">
    function goToPayPal()
    {
    window.document.forms[0].action = 'https:\/\/www.paypal.com\/cgi-bin\/webscr';
    window.document.forms[0].submit();
    }
    </script>

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="">
    <input type="hidden" name="item_name" value="StaxRip donation">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="currency_code" value="EUR">
    <input type="hidden" name="tax" value="0">
    <input type="hidden" name="bn" value="PP-DonationsBF">
    <input type="button" value="test" name="submit" onclick="goToPayPal()">
    </form>
     
    stax, Mar 22, 2007
    #1
    1. Advertising

  2. Scripsit stax:

    > a PayPal button is typically a image, is it possible to use a real
    > button?


    Surely. In rare cases, a server uses information about the coordinates of
    the click on an image submit button, but in most situations, you can replace
    it by a normal submit button.

    > <input type="image"
    > src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0"
    > name="submit">


    That's the image submit button.

    > <input type="button" value="test" name="submit"
    > onclick="goToPayPal()">


    No, you don't need anything that complicated, and using JavaScript for form
    submission would make the form non-functional when JavaScript execution is
    disabled in browser settings.

    Just use a normal submit button:

    <input type="submit" value="Donate">

    The value="..." attribute specifies the text that will appear in the button.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 22, 2007
    #2
    1. Advertising

  3. stax

    J.O. Aho Guest

    stax wrote:
    > Hello,
    > a PayPal button is typically a image, is it possible to use a real button?
    >
    > thx
    > stax
    >
    > This is the typical markup:
    >
    > <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    > <input type="hidden" name="cmd" value="_xclick">
    > <input type="hidden" name="business" value="">
    > <input type="hidden" name="item_name" value="StaxRip donation">
    > <input type="hidden" name="no_shipping" value="1">
    > <input type="hidden" name="currency_code" value="EUR">
    > <input type="hidden" name="tax" value="0">
    > <input type="hidden" name="bn" value="PP-DonationsBF">


    <button name="submit" type="submit" style="background-repeat: no-repeat;
    background-position: left top; background-image:
    img('https://www.paypal.com/en_US/i/btn/x-click-but04.gif')"
    onclick="goToPayPal()">Press Here</button>

    > <img border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif"
    > width="1" height="1">
    > </form>


    Thats what you was looking for?
    --

    //Aho
     
    J.O. Aho, Mar 22, 2007
    #3
  4. stax

    stax Guest

    Jukka K. Korpela wrote:
    > Scripsit stax:
    >
    >> a PayPal button is typically a image, is it possible to use a real
    >> button?

    >
    > Surely. In rare cases, a server uses information about the coordinates
    > of the click on an image submit button, but in most situations, you can
    > replace it by a normal submit button.
    >
    >> <input type="image"
    >> src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0"
    >> name="submit">

    >
    > That's the image submit button.
    >
    >> <input type="button" value="test" name="submit"
    >> onclick="goToPayPal()">

    >
    > No, you don't need anything that complicated, and using JavaScript for
    > form submission would make the form non-functional when JavaScript
    > execution is disabled in browser settings.
    >
    > Just use a normal submit button:
    >
    > <input type="submit" value="Donate">
    >
    > The value="..." attribute specifies the text that will appear in the
    > button.
    >


    Detailed answer with simple solution, thanks!
     
    stax, Mar 22, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    858
    Purvi T
    Oct 19, 2004
  2. Wes Weems
    Replies:
    1
    Views:
    485
    Natty Gur
    Jul 20, 2003
  3. Chris Lane
    Replies:
    4
    Views:
    11,242
    Chris Lane
    Nov 17, 2003
  4. Tim
    Replies:
    0
    Views:
    425
  5. Hiten
    Replies:
    1
    Views:
    633
    Vidar Petursson
    May 26, 2004
Loading...

Share This Page