听起来你已经解决了这个问题,但为了正确的上下文:以下是Mitchel Sellers关于主题的博客文章:
To include an HTML form within DNN you
will first need to note the "Action"
property that is set in the
tag. Once you know this action you
will want to remove the opening and
closing form tags. Now, in the HTML
source location the submit button
( or similar) .
Then add the following inside the tag
declara tion.
onClick="this.form.action= YourUrlHere ;this.form.submit();"
Be sure to put your Action URL inplace
of the "YourUrlHere" text. This tells
the HTML form that if the submit
button is clicked that it should
change the form action, which will
prevent ASP.NET postback and then it
actually submits the form to the new
URL.
This provides you a quick and reliable
method to submit HTML forms to
external sites. This isn t the best
solution as other input items on the
current page will be submitted to the
action page, however, typically that
is not too large of an issue.
下面是我使用jQuery提出的一个更为复杂的方法/示例,它应该专门解决您的问题:
<p class="item">
Buy <span class="name">A Product</span> for $<span class="price">9.99</span>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif" style="border:solid 0px black;" name="submit" alt="click here to order">
</p>
$( p.item input[type=image] ).click(function(){
var $itemDetail = $this.parent( p.item );
var name = $itemDetail.find( .name ).val();
var price = $itemDetail.find( .price ).val();
window.open( https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=youremail%40address.com&item_name= + name + &amount= + price + &no_note=1¤cy_code=USD&add=1 , yourcartwindowname );
});
这种方法的重要特征是为您提供一个html“模板”,该模板可以重复使用,并可用于每个项目。它还会在一个新窗口中打开PayPal购物车页面,如果用户在购物车中添加了多个项目,它会保持同一窗口。非常简单但相对快速且易于实现,如果您可以依赖JavaScript实现此功能的话。