- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
好吧,这是我的代码......基本上我遇到了最终金额的问题......如果你购买 1 份礼物一个像素板并选择英国,它应该是 18.48 英镑,但实际上是 1 英镑17.50?我已经看过这个,一个更有知识的人已经简单地看过这个,找不到任何问题,所以我希望你们中的一位天才能够帮助我解决我遇到的这个问题......赞赏!
<!DOCTYPE html>
<!-- HTML Select Junior Example 0.4 -->
<!-- Please note the code on these pages are provided by WorldPay as working examples only. -->
<!-- Any changes you make to the copies of these pages will not be supported by WorldPay. -->
<!-- For further information on reading html see the supplied help section. -->
<html>
<!-- The name, style, and properties of the page are defined in the 'head' tags -->
<head>
<title>Pixboard Postage Price</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Junior HTML Example 0.4">
<meta name="keywords" content="Junior, html">
<style type="text/css"> td {text-align:"left"; vertical-align:"middle"; font-family:"arial"; color:"black"} h1,h2,h3,h4,h5,h6,h7 {text-align:"center"; vertical-align:"middle"; font-family:"arial"; color:"black"}</style>
</head>
<!-- The content to be used on the page is placed between the 'body' tags. -->
<body>
<!-- This is a purchase token, for more information on the elements with in a purchase token see the supplied help section. -->
<!-- PLEASE NOTE: this is a test installation and values will require changing to reflect merchants requirements -->
<form action="https://secure-test.worldpay.com/wcc/purchase" method="post" name="BuyForm">
<input type="hidden" name="instId" value="211616"><!-- The "instId" value "0000000" should be replaced with the Merchant's own installation Id -->
<input type="hidden" name="cartId" value="abc123"><!-- This is a unique identifier for merchants use. Example: PRODUCT123 -->
<input type="hidden" name="currency" value="GBP"><!-- Choose appropriate currency that you would like to use -->
<input type="hidden" name="desc" value="">
<input type="hidden" name="testMode" value="100">
<!-- JavaScript is used to give functionality to some of the pages elements -->
<script language="JavaScript">
// The next two functions round numbers to numerical formatting. They do not need to be altered when adding or removing products.
function roundOff(value, precision)
{
return places(value,1,precision);
}
function places(X, M, N)
{
var T, S=new String(Math.round(X*Number("1e"+N)))
while (S.length<M+N) S='0'+S
var y = S.substr(0, T=(S.length-N));
if(N>0)
{
y += '.' + S.substr(T, N);
}
return y;
}
// This function checks for empty quantities. It does not need to be altered when adding or removing products.
function CheckNull(value)
{
if (value == "")
{
value = "0";
}
return value;
}
// This function defines the postage and packaging location. It does not need to be altered when adding or removing products.
function typeOfCarriage(x,whereabouts)
{
console.log(whereabouts);
x.carriage_amount.value = whereabouts;
}
// This function addeds the postage and packaging to the total price of the products. Add new postage rates here, and also edit further down the page to add them to the table.
function calculate(x)
{
basicprice = calc(x);
if(Number(basicprice) > 0)
{
console.log(basicprice);
switch (x.carriage_amount.value)
{
case "UK" :
postage_and_packaging = 3.50;
break
case "US" :
postage_and_packaging = 5.75;
break
// To add a new postage rate. Copy from here...
case "asia" :
postage_and_packaging = 5.75;
break
// ...to here, and paste directly below. Change the case country, and the postage price. You will also need to add the postage option you have created further down the page.
default :
postage_and_packaging = 8.75;
break;
}
x.amount.value = parseInt(basicprice) + Number(postage_and_packaging);
}
else
{
x.amount.value = "0";
}
x.amount.value = roundOff(x.amount.value,2);
}
// The standard price, exluding postage and packaging is calculated here. It does not need to be altered when adding or removing products. -->
function calc(x)
{
x.amount.value = 0;
var y = x.price.length;
var z = x.qty.length;
var a = Number(x.amount.value);
var b,c;
while(y > 0)
{
b = Number(CheckNull(x.price[y-1].value));
c = Number(CheckNull(x.qty[y-1].value));
a += (b * c);
y--;
}
return a;
}
</script>
<h1>Postage & Packaging</h1>
<!-- This table provides layout for the products listed. -->
<table cellPadding="3" border="2" align="center">
<tr>
<td colSpan="3"><b>Gift</b><input name="price" type="hidden" value="3.99"> - £3.99</td>
</tr>
<tr>
<td>Quantity: <input name="qty" size="3" value="0"></td>
</tr>
<tr>
<td colSpan="3"><b>195 x 295 Pixboard</b><input name="price" type="hidden" value="10.99"> - £10.99</td>
</tr>
<tr>
<td>Quantity: <input name="qty" size="3" value="1"></td>
</tr>
</table>
<br><br>
<!-- This table is used as the total calculator and postage and packaging selector. -->
<input name="carriage_amount" type="hidden" value="uk">
<table cellPadding="3" border=2 align="center">
<tr>
<td>
<select name=postage_and_packaging onchange="typeOfCarriage(this.form,this.value);calculate(this.form)">
<OPTION SELECTED VALUE="">Please select country</option>
<OPTION value='AF'>Afghanistan</option>
<OPTION value='AL'>Albania</option>
<OPTION value='DZ'>Algeria</option>
<OPTION value='AS'>American Samoa</option>
<OPTION value='AD'>Andorra</option>
<OPTION value='AO'>Angola</option>
<OPTION value='AI'>Anguilla</option>
<OPTION value='AQ'>Antarctica</option>
<OPTION value='AG'>Antigua and Barbuda</option>
<OPTION value='AR'>Argentina</option>
<OPTION value='AM'>Armenia</option>
<OPTION value='AW'>Aruba</option>
<OPTION value='AU'>Australia</option>
<OPTION value='AT'>Austria</option>
<OPTION value='AZ'>Azerbaijan</option>
<OPTION value='BS'>Bahamas</option>
<OPTION value='BH'>Bahrain</option>
<OPTION value='BD'>Bangladesh</option>
<OPTION value='BB'>Barbados</option>
<OPTION value='BY'>Belarus</option>
<OPTION value='BE'>Belgium</option>
<OPTION value='BZ'>Belize</option>
<OPTION value='BJ'>Benin</option>
<OPTION value='BM'>Bermuda</option>
<OPTION value='BT'>Bhutan</option>
<OPTION value='BO'>Bolivia</option>
<OPTION value='BA'>Bosnia and Herzegovina</option>
<OPTION value='BW'>Botswana</option>
<OPTION value='BV'>Bouvet Island</option>
<OPTION value='br'>brazil</option>
<OPTION value='IO'>british Indian Ocean Territory</option>
<OPTION value='BN'>brunei Darussalam</option>
<OPTION value='BG'>Bulgaria</option>
<OPTION value='BF'>Burkina Faso</option>
<OPTION value='BI'>Burundi</option>
<OPTION value='KH'>Cambodia</option>
<OPTION value='CM'>Cameroon</option>
<OPTION value='CA'>Canada</option>
<OPTION value='CV'>Cape Verde</option>
<OPTION value='KY'>Cayman Islands</option>
<OPTION value='CF'>Central African Republic</option>
<OPTION value='td'>Chad</option>
<OPTION value='CL'>Chile</option>
<OPTION value='CN'>China</option>
<OPTION value='CX'>Christmas Island</option>
<OPTION value='CC'>Cocos (Keeling) Islands</option>
<OPTION value='CO'>Colombia</option>
<OPTION value='KM'>Comoros</option>
<OPTION value='CG'>Congo</option>
<OPTION value='CK'>Cook Islands</option>
<OPTION value='CR'>Costa Rica</option>
<OPTION value='HR'>Croatia</option>
<OPTION value='CU'>Cuba</option>
<OPTION value='CY'>Cyprus</option>
<OPTION value='CZ'>Czech Republic</option>
<OPTION value='CI'>Côte d'Ivoire</option>
<OPTION value='DK'>Denmark</option>
<OPTION value='DJ'>Djibouti</option>
<OPTION value='DM'>Dominica</option>
<OPTION value='DO'>Dominican Republic</option>
<OPTION value='TP'>East Timor</option>
<OPTION value='EC'>Ecuador</option>
<OPTION value='EG'>Egypt</option>
<OPTION value='SV'>El salvador</option>
<OPTION value='GQ'>Equatorial Guinea</option>
<OPTION value='ER'>Eritrea</option>
<OPTION value='EE'>Estonia</option>
<OPTION value='ET'>Ethiopia</option>
<OPTION value='FK'>Falkland Islands</option>
<OPTION value='FO'>Faroe Islands</option>
<OPTION value='FJ'>Fiji</option>
<OPTION value='FI'>Finland</option>
<OPTION value='FR'>France</option>
<OPTION value='GF'>French Guiana</option>
<OPTION value='PF'>French Polynesia</option>
<OPTION value='TF'>French Southern Territories</option>
<OPTION value='GA'>Gabon</option>
<OPTION value='GM'>Gambia</option>
<OPTION value='GE'>Georgia</option>
<OPTION value='DE'>Germany</option>
<OPTION value='GH'>Ghana</option>
<OPTION value='GI'>Gibraltar</option>
<OPTION value='GR'>Greece</option>
<OPTION value='GL'>Greenland</option>
<OPTION value='GD'>Grenada</option>
<OPTION value='GP'>Guadeloupe</option>
<OPTION value='GU'>Guam</option>
<OPTION value='GT'>Guatemala</option>
<OPTION value='GN'>Guinea</option>
<OPTION value='GW'>Guinea-Bissau</option>
<OPTION value='GY'>Guyana</option>
<OPTION value='HT'>Haiti</option>
<OPTION value='HM'>Heard Island and McDonald Islands</option>
<OPTION value='VA'>Holy See (Vatican City State)</option>
<OPTION value='HN'>Honduras</option>
<OPTION value='HK'>Hong Kong</option>
<OPTION value='HU'>Hungary</option>
<OPTION value='IS'>Iceland</option>
<OPTION value='IN'>India</option>
<OPTION value='ID'>Indonesia</option>
<OPTION value='IR'>Iran</option>
<option value='IE'>Ireland</option>
<option value='IL'>Israel</option>
<option value='IT'>Italy</option>
<option value='JM'>Jamaica</option>
<option value='JP'>Japan</option>
<option value='JO'>Jordan</option>
<option value='KZ'>Kazakstan</option>
<option value='KE'>Kenya</option>
<option value='KI'>Kiribati</option>
<option value='KW'>Kuwait</option>
<option value='KG'>Kyrgystan</option>
<option value='LA'>Lao</option>
<option value='LV'>Latvia</option>
<option value='LB'>Lebanon</option>
<option value='LS'>Lesotho</option>
<option value='LR'>Liberia</option>
<option value='LY'>Libyan Arab Jamahiriya</option>
<option value='LI'>Liechtenstein</option>
<option value='LT'>Lithuania</option>
<option value='LU'>Luxembourg</option>
<option value='MO'>Macau</option>
<option value='MK'>Macedonia (FYR)</option>
<option value='MG'>Madagascar</option>
<option value='MW'>Malawi</option>
<option value='MY'>Malaysia</option>
<option value='MV'>Maldives</option>
<option value='ML'>Mali</option>
<option value='MT'>Malta</option>
<option value='MH'>Marshall Islands</option>
<option value='MQ'>Martinique</option>
<option value='MR'>Mauritania</option>
<option value='MU'>Mauritius</option>
<option value='YT'>Mayotte</option>
<option value='MX'>Mexico</option>
<option value='FM'>Micronesia</option>
<option value='MD'>Moldova</option>
<option value='MC'>Monaco</option>
<option value='MN'>Mongolia</option>
<option value='MS'>Montserrat</option>
<option value='MA'>Morocco</option>
<option value='MZ'>Mozambique</option>
<option value='MM'>Myanmar</option>
<option value='NA'>Namibia</option>
<option value='NR'>Nauru</option>
<option value='NP'>Nepal</option>
<option value='NL'>Netherlands</option>
<option value='AN'>Netherlands Antilles</option>
<option value='NT'>Neutral Zone</option>
<option value='NC'>New Caledonia</option>
<option value='NZ'>New Zealand</option>
<option value='NI'>Nicaragua</option>
<option value='NE'>Niger</option>
<option value='NG'>Nigeria</option>
<option value='NU'>Niue</option>
<option value='NF'>Norfolk Island</option>
<option value='KP'>North Korea</option>
<option value='MP'>Northern Mariana Islands</option>
<option value='NO'>Norway</option>
<option value='OM'>Oman</option>
<option value='PK'>Pakistan</option>
<option value='PW'>Palau</option>
<option value='PA'>Panama</option>
<option value='PG'>Papua New Guinea</option>
<option value='PY'>Paraguay</option>
<option value='PE'>Peru</option>
<option value='PH'>Philippines</option>
<option value='PN'>Pitcairn</option>
<option value='PL'>Poland</option>
<option value='PT'>Portugal</option>
<option value='PR'>Puerto Rico</option>
<option value='QA'>Qatar</option>
<option value='RE'>Reunion</option>
<option value='RO'>Romania</option>
<option value='RU'>Russian Federation</option>
<option value='RW'>Rwanda</option>
<option value='SH'>Saint Helena</option>
<option value='KN'>Saint Kitts and Nevis</option>
<option value='LC'>Saint Lucia</option>
<option value='PM'>Saint Pierre and Miquelon</option>
<option value='VC'>Saint Vincent and the Grenadines</option>
<option value='WS'>Samoa</option>
<option value='SM'>San Marino</option>
<option value='ST'>Sao Tome and Principe</option>
<option value='SA'>Saudi Arabia</option>
<option value='SN'>Senegal</option>
<option value='SC'>Seychelles</option>
<option value='SL'>Sierra Leone</option>
<option value='SG'>Singapore</option>
<option value='SK'>Slovakia</option>
<option value='SI'>Slovenia</option>
<option value='SB'>Solomon Islands</option>
<option value='SO'>Somalia</option>
<option value='ZA'>South Africa</option>
<option value='GS'>South Georgia</option>
<option value='KR'>South Korea</option>
<option value='ES'>Spain</option>
<option value='LK'>Sri Lanka</option>
<option value='SD'>Sudan</option>
<option value='SR'>Suriname</option>
<option value='SJ'>Svalbard and Jan Mayen Islands</option>
<option value='SZ'>Swaziland</option>
<option value='SE'>Sweden</option>
<option value='CH'>Switzerland</option>
<option value='SY'>Syria</option>
<option value='TW'>Taiwan</option>
<option value='TJ'>Tajikistan</option>
<option value='TZ'>Tanzania</option>
<option value='TH'>Thailand</option>
<option value='TG'>Togo</option>
<option value='TK'>Tokelau</option>
<option value='TO'>Tonga</option>
<option value='TT'>trinidad and Tobago</option>
<option value='TN'>Tunisia</option>
<option value='tr'>Turkey</option>
<option value='TM'>Turkmenistan</option>
<option value='TC'>Turks and Caicos Islands</option>
<option value='TV'>Tuvalu</option>
<option value='UG'>Uganda</option>
<option value='UA'>Ukraine</option>
<option value='AE'>United Arab Emirates</option>
<option value='UK'>United Kingdom</option>
<option value='UM'>United States Minor Outlying Islands</option>
<option value='US'>United States of America</option>
<option value='UY'>Uruguay</option>
<option value='UZ'>Uzbekistan</option>
<option value='VU'>Vanuatu</option>
<option value='VE'>Venezuela</option>
<option value='VN'>Viet Nam</option>
<option value='VG'>Virgin Islands (british)</option>
<option value='VI'>Virgin Islands (U.S.)</option>
<option value='WF'>Wallis and Futuna Islands</option>
<option value='EH'>Western Sahara</option>
<option value='YE'>Yemen</option>
<option value='YU'>Yugoslavia</option>
<option value='ZR'>Zaire</option>
<option value='ZM'>Zambia</option>
<option value='ZW'>Zimbabwe</option>
</select>
<p>
<input name="calcButton" onclick="calculate(this.form)" type=button value="Calculate Total">
<p>
<b>Total: £ </b><input name="amount" size=8 value="0">
</td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center">
<action="demo_form.asp" method="get">
<input type="checkbox" name="vehicle" value="Bike"> Free Pen<br>
</p>
<!-- This generates a button that submits the information and send the user into the Worldpay payment pages. -->
<p align="center"><input type=submit value=Checkout onclick="calculate(this.form)"></p>
</form>
</body>
</html>
最佳答案
ParseInt
函数仅提取整数部分。
第 95 行:
x.amount.value = parseInt(basicprice) + Number(postage_and_packaging);
将其更改为以下内容:
x.amount.value = basicprice + Number(postage_and_packaging);
关于javascript - 计算邮寄和包装的成本总是少了几美分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33742307/
我不明白 int 63823 为何比 double 1.0 占用更少的空间。在这个特定实例中,int 中是否没有存储更多信息? 最佳答案 I don't understand how an int 6
这可能不是一个直接的代码问题,但它是一个经常出现在 SO 上的问题,我发现阅读它非常有用。 App Store - Help answering “Missing Compliance” (using
我在我们的应用程序中使用 syncfusion 寻呼机和下拉列表请打开以下链接。 https://stackblitz.com/edit/angular-nv6myv?file=src%2Fapp%2
以便解释指针和引用in this question我写了这段代码。 MyClass& MyClass::MyInstance() { static MyClass & myLoca
在 C 和 C++ 中,assert 是一个非常 重量级例程,将错误写入 stdout 并终止程序。在我们的应用程序中,我们实现了一个更强大的 assert 替代品,并为其提供了自己的宏。已尽一切努力
我已经创建了一个 MVC webApi 项目,现在我想使用身份验证和授权。我想我已经实现了这种安全措施,但由于某种原因,有些事情变糟了,当我编写我的凭据并尝试调用一些 webApi 方法时,显示消息“
我发现自己使用一种奇怪的方式向我的函数添加回调函数,我想知道是否有更通用的方式向函数添加回调函数,最好的情况是我的所有函数都检查最后给定的作为函数的参数,如果是,则将其用作回调。 我以前是这样的: v
几乎从来没有我只想获取某个 Remote 的情况;我总是想要所有的 Remote 。我认为这将是一个足够常见的用例,git 会考虑它(与他们有 pull.rebase true 的方式相同)。 那么,
我正在尝试使用 inarray 但它总是返回 true?有任何想法吗? (所有 li 均已显示) $("#select-by-color-list li").hide(); // get the se
我正在尝试为我公司的开发环境设置过期网址。我们使用 lighttpd在此环境中提供上传的文件,我发现 these docs这似乎相当有希望。 问题是我似乎根本无法让它工作,而且我有点不知所措,试图找出
我无法让“文件夹”外部变量工作。我总是得到[:]。 我正在 Windows 下的 Grails 上进行开发(这就是为什么外部配置文件看起来像 file:C:\path\to/file)。 我在另一个项
这个问题是出于对 PL 如何工作的好奇,而不是其他任何事情。 (它实际上是在查看与 Haskell 不同的 SML 时想到的,因为前者使用按值调用 - 但我的问题是关于 Haskell。) Haske
我有一个高速缓存内存模块,我希望它是可字寻址的,但有字节的写使能信号。 always @ (posedge clk) begin //stuff... if(write) begin
我正在处理一些代码,其中一个对象“foo”正在创建另一个对象对象“bar”,并向其传递一个Callable。之后 foo 将返回bar,然后我希望 foo 变得无法访问(即:可用于垃圾收集)。 我最初
我已将我的程序与此方法相关联: public static void CreateFileAssociation(string extension, string key, string descri
所以我正在进行目录遍历,但我无法让 opendir 按照我想要的方式工作。它总是无法打开我发送的目录,它给出了一些未知的错误。我通常传入 argv[1],但我放弃了,只是开始硬编码路径。 char *
这个问题在这里已经有了答案: How do I compare strings in Java? (23 个回答) 关闭 9 年前。 出于某种原因,我的(基本)程序总是打印我为 else 语句保留的
我不想冒为此提出破解的风险,因为它涉及 datetime 对象。基本上,我想按如下方式进行转换: 2010-04-21 06:37:53 -> 2010-04-21 06:40:00 2010-08-
我正在用 C 语言玩文件 I/O。我正在尝试使用 fgets 从一个文件中读取数据并将其输出到另一个文件。问题是它总是返回 NULL,因此没有任何内容被复制到输出文件中。这是我的代码: #includ
class MyClass { // empty class with no base class }; int main() { MyClass* myClass = new MyC
我是一名优秀的程序员,十分优秀!