一: form提交


function paypalSubmit() {
var paypalform;
var formMain;
var paypalendingUrl = "<% =HostUrl%>pay/Paypalending.aspx";
var PaypalCancelUrl = "<% =HostUrl%>pay/PaypalCancel.aspx"
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
paypalform = document.formPaypal;
formMain = document.Form1;
paypalform.all.item("cmd").value = "_xclick";
paypalform.all.item("business").value = "​​​youraccount@163.com​​​";
paypalform.all.item("return").value = paypalendingUrl+"?PayPal=1&LangTypeID=<%=LangTypeID%>";
paypalform.all.item("undefinded_quantity").value = "1";
var itemname = '<% =PaypalItemNumber %>';
if(itemname.length>4)
{
paypalform.all.item("item_name").value = "<% =PaypalItemNumber %>";
}
paypalform.all.item("item_number").value = "<% =PaypalItemNumber %>";
paypalform.all.item("no_shipping").value = "2";
paypalform.all.item("cancel_return").value = paypalendingUrl+"?PayPal=2&LangTypeID=<%=LangTypeID%>";
paypalform.all.item("no_note").value = "0";
paypalform.all.item("payer_id").value = formMain.all.item("ucCheckOutResult_lblOrderNumber").innerText;
paypalform.all.item("custom").value = formMain.all.item("ucCheckOutResult_lblOrderNumber").innerText;
paypalform.all.item("invoice").value = "<% =Invoice %>";//票据
paypalform.all.item("notify_url").value = paypalendingUrl+"?PayPal=3&LangTypeID=<%=LangTypeID%>";
paypalform.all.item("currency_code").value = "<%=CartCurrency%>";
paypalform.all.item("amount").value = 200.99;
paypalform.all.item("bn").value = "web.Shop.0.4";
paypalform.submit();
}
else {
paypalform = document.forms["formPaypal"];
formMain = document.forms["Form1"];
paypalform.elements["cmd"].value = "_xclick";
paypalform.elements["business"].value = "​​​youraccountemail@163.com​​​";
paypalform.elements["return"].value = paypalendingUrl+"?PayPal=1&LangTypeID=<%=LangTypeID%>";
paypalform.elements["item_number"].value = "<% =PaypalItemNumber %>";
paypalform.elements["undefinded_quantity"].value = "1";
var itemname2 = '<% =PaypalItemNumber %>';
if(itemname2.length>4)
{
paypalform.elements["item_name"].value = "<% =PaypalItemNumber %>";
}
paypalform.elements["no_shipping"].value = "2";
paypalform.elements["cancel_return"].value = paypalendingUrl+"?PayPal=2&LangTypeID=<%=LangTypeID%>";
paypalform.elements["no_note"].value = "0";
if(formMain.elements["ucCheckOutResult_txtOrderNumber"]!=null)
{
paypalform.elements["payer_id"].value = formMain.elements["ucCheckOutResult_txtOrderNumber"].value;
}
else
{
paypalform.elements["payer_id"].value = "";

}
if(formMain.elements["ucCheckOutResult_txtOrderNumber"] != null)
{
paypalform.elements["custom"].value = formMain.elements["ucCheckOutResult_txtOrderNumber"].value;

}
else
{
paypalform.elements["custom"].value = "";
}
paypalform.elements["invoice"].value = "<% =Invoice %>";//票据
paypalform.elements["notify_url"].value = paypalendingUrl+"?PayPal=3&LangTypeID=<%=LangTypeID%>";
paypalform.elements["currency_code"].value = "<%=CartCurrency%>";

if(formMain.elements["ucCartInfo_txtLevelingAmount"]!=null)
{
levelingAmount = formMain.elements["ucCartInfo_txtLevelingAmount"].value;

}
paypalform.elements["amount"].value = 100.99;
paypalform.elements["bn"].value = "web.Shop.0.4";
paypalform.submit();
}
}
-------------------
c#里也可以用服务端代码提交
private void Button1_Click(object sender, System.EventArgs e)
{
string postData = "";
postData += "currency_code=USD";
  postData += "&cmd=_xclick";
  postData += ​​​&business=youraccountemail@163.com​​​;
  postData += "&upload=1";
  postData += "&cancel_return="+HostUrl +"pay/Paypalending.aspx";
postData += "&item_name=wowgn000255555";
postData += "&quantity=1";
postData += "&amount=280.23";
postData += "&no_shipping=2";
  byte[] data = Encoding.ASCII.GetBytes(postData);
Response.Redirect("​​​https://www.paypal.com/cgi-bin/webscr?"+postData​​​);
} <form name="formPaypal" οnsubmit="return check()" action="​​https://www.paypal.com/cgi-bin/webscr​​​"
method="post">
<input id="cmd" type="hidden" name="cmd"><input type="hidden" name="redirect_cmd"><input type="hidden" name="business"><input type="hidden" name="return"><input type="hidden" name="undefinded_quantity"><input type="hidden" name="item_name"><input type="hidden" name="item_number"><input type="hidden" name="no_shipping"><input type="hidden" name="cancel_return"><input type="hidden" name="no_note"><input type="hidden" name="payer_id"><input type="hidden" name="custom"><input type="hidden" name="invoice"><input type="hidden" name="first_name"><input type="hidden" name="last_name"><input type="hidden" name="address1"><input type="hidden" name="address2"><input type="hidden" name="city"><input type="hidden" name="state"><input type="hidden" name="zip"><input type="hidden" name="notify_url"><input type="hidden" name="amount"><input type="hidden" name="currency_code"><input type="hidden" name="bn"><input type="hidden" name="lc" value="US">
</form>
提交js