Problem with button

S

stax

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="(e-mail address removed)">
<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="(e-mail address removed)">
<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>
 
J

Jukka K. Korpela

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.
 
J

J.O. Aho

stax said:
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="(e-mail address removed)">
<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 said:
<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?
 
S

stax

Jukka said:
Scripsit stax:


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.


That's the image submit button.


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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top