One solution might be to add each Paypal "cart form" code to the page as a hidden element, then for the enlarged image's link, specify a JavaScript URL that submits this form in place of an ordinary HTML.
Firstly, you'd add the Paypal code to your page as a hidden element, for example:
Code:
<form id="item1" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="display:hidden">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MII..... ==-----END PKCS7-----">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
The changes here to the Paypal code are:
1) Add an ID attribute to it to uniquely identify this form.
2) Add a display:hidden CSS declaration to hide the form on the page.
3) Remove the "target" attribute to prevent it from interfering with JavaScript submission (remove the grayed out part above).
With the above changes to your Paypal code, next step is to replace the URL of the enlarged image the form should be associated with with a JavaScript URL that submits this form when clicked on, for example:
<a href="http://www.nasa.gov/images/content/168177main_image_feature_749_ys_4.jpg" rel="enlargeimage" rev="targetdiv:loadarea,link:javascript:jQuery('#item1').submit()">The Moon #1</a>
The key here is to use the URL syntax "javascript:jQuery", then replace "item1" with the ID of each of your Paypal form's ID attribute value.
Finally in order for the JavaScript URL syntax to be recognized by the script, inside the .js file, find the below line:
Code:
var namevalpair=rawopts[i].split(/:(?!\/\/)/) //avoid spitting ":" inside "http://blabla"
and change it to:
Code:
var namevalpair=rawopts[i].split(/:(?!\/\/|jQuery)/) //avoid spitting ":" inside "http://blabla"
]
That should do it.
Bookmarks