comparison paypal/classic.html @ 0:599d0315537d laserkard

[svn r1] initial import
author rlm
date Wed, 30 Dec 2009 02:01:25 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:599d0315537d
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html>
3
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
6 <title></title>
7
8
9 <!-- Start of Script -->
10 <script type="text/javascript">
11 <!--
12 //
13 function Dollar (val) { // force to valid dollar amount
14 var str,pos,rnd=0;
15 if (val < .995) rnd = 1; // for old Netscape browsers
16 str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape
17 pos = str.indexOf (".");
18 if (pos > 0) str = str.substring (rnd, pos + 3);
19 return str;
20 }
21
22 var amt,des,obj,val,op1a,op1b,op2a,op2b,op3a,op3b,op4a,op4b,op5a,op5b,op6a,op6b,op7a,op7b,op8a,op8b,op9a,op9b,itmn;
23
24 function ChkTok (obj1) {
25 var j,tok,ary=new Array (); // where we parse
26 ary = val.split (" "); // break apart
27 for (j=0; j<ary.length; j++) { // look at all items
28 // first we do single character tokens...
29 if (ary[j].length < 2) continue;
30 tok = ary[j].substring (0,1); // first character
31 val = ary[j].substring (1); // get data
32 if (tok == "@") amt = val * 1.0;
33 if (tok == "+") amt = amt + val*1.0;
34 if (tok == "%") amt = amt + (amt * val/100.0);
35 if (tok == "-") amt = amt - val*1.0;
36 if (tok == "#") { // record item number
37 if (obj1.item_number) obj1.item_number.value = val;
38 ary[j] = ""; // zap this array element
39 }
40 // Now we do 3-character tokens...
41 if (ary[j].length < 4) continue;
42 tok = ary[j].substring (0,3); // first 3 chars
43 val = ary[j].substring (3); // get data
44 if (tok == "s1=") { // value for shipping
45 if (obj1.shipping) obj1.shipping.value = val;
46 ary[j] = ""; // clear it out
47 }
48 if (tok == "s2=") { // value for shipping2
49 if (obj1.shipping2) obj1.shipping2.value = val;
50 ary[j] = ""; // clear it out
51 }
52 }
53 val = ary.join (" "); // rebuild val with what's left
54 }
55
56 function StorVal () {
57 var tag;
58 tag = obj.name.substring (obj.name.length-2); // get flag
59 if (tag == "1a") op1a = op1a + " " + val;
60 else if (tag == "1b") op1b = op1b + " " + val;
61 else if (tag == "2a") op2a = op2a + " " + val;
62 else if (tag == "2b") op2b = op2b + " " + val;
63 else if (tag == "3a") op3a = op3a + " " + val;
64 else if (tag == "3b") op3b = op3b + " " + val;
65 else if (tag == "4a") op4a = op4a + " " + val;
66 else if (tag == "4b") op4b = op4b + " " + val;
67 else if (tag == "5a") op5a = op5a + " " + val;
68 else if (tag == "5b") op5b = op5b + " " + val;
69 else if (tag == "6a") op6a = op6a + " " + val;
70 else if (tag == "6b") op6b = op6b + " " + val;
71 else if (tag == "7a") op7a = op7a + " " + val;
72 else if (tag == "7b") op7b = op7b + " " + val;
73 else if (tag == "8a") op8a = op8a + " " + val;
74 else if (tag == "8b") op8b = op8b + " " + val;
75 else if (tag == "9a") op9a = op9a + " " + val;
76 else if (tag == "9b") op9b = op9b + " " + val;
77 else if (tag == "3i") itmn = itmn + " " + val;
78 else if (des.length == 0) des = val;
79 else des = des + ", " + val;
80 }
81
82 function ReadForm (obj1, tst) { // Read the user form
83 var i,j,pos;
84 amt=0;des="";op1a="";op1b="";op2a="";op2b="";op3a="";op3b="";op4a="";op4b="";op5a="";op5b="";op6a="";op6b="";op7a="";op7b="";op8a="";op8b="";op9a="";op9b="";itmn="";
85 if (obj1.baseamt) amt = obj1.baseamt.value*1.0; // base amount
86 if (obj1.basedes) des = obj1.basedes.value; // base description
87 if (obj1.baseon0) op1a = obj1.baseon0.value; // base options
88 if (obj1.baseos0) op1b = obj1.baseos0.value;
89 if (obj1.baseon1) op2a = obj1.baseon1.value;
90 if (obj1.baseos1) op2b = obj1.baseos1.value;
91 if (obj1.baseon2) op3a = obj1.baseon2.value;
92 if (obj1.baseos2) op3b = obj1.baseos2.value;
93 if (obj1.baseon3) op4a = obj1.baseon3.value;
94 if (obj1.baseos3) op4b = obj1.baseos3.value;
95 if (obj1.baseon4) op5a = obj1.baseon4.value;
96 if (obj1.baseos4) op5b = obj1.baseos4.value;
97 if (obj1.baseon5) op6a = obj1.baseon5.value;
98 if (obj1.baseos5) op6b = obj1.baseos5.value;
99 if (obj1.baseon6) op7a = obj1.baseon6.value;
100 if (obj1.baseos6) op7b = obj1.baseos6.value;
101 if (obj1.baseon7) op8a = obj1.baseon7.value;
102 if (obj1.baseos7) op8b = obj1.baseos7.value;
103 if (obj1.baseon8) op9a = obj1.baseon8.value;
104 if (obj1.baseos8) op9b = obj1.baseos8.value;
105 if (obj1.baseitn) itmn = obj1.baseitn.value;
106 for (i=0; i<obj1.length; i++) { // run entire form
107 obj = obj1.elements[i]; // a form element
108 if (obj.type == "select-one") { // just selects
109 if (obj.name == "quantity" ||
110 obj.name == "amount") continue;
111 pos = obj.selectedIndex; // which option selected
112 val = obj.options[pos].value; // selected value
113 ChkTok (obj1); // check for any specials
114
115 if (obj.name == "on0" || // let this go where it wants
116 obj.name == "os0" ||
117 obj.name == "on1" ||
118 obj.name == "os1" ||
119 obj.name == "on2" ||
120 obj.name == "os2" ||
121 obj.name == "on3" ||
122 obj.name == "os3" ||
123 obj.name == "on4" ||
124 obj.name == "os4" ||
125 obj.name == "on5" ||
126 obj.name == "os5" ||
127 obj.name == "on6" ||
128 obj.name == "os6" ||
129 obj.name == "on7" ||
130 obj.name == "os7" ||
131 obj.name == "on8" ||
132 obj.name == "os8" ||
133 obj.name == "on9" ||
134 obj.name == "os9") continue;
135
136 StorVal ();
137
138 } else
139 if (obj.type == "checkbox" || // just get checkboxex
140 obj.type == "radio") { // and radios
141 if (obj.checked) {
142 val = obj.value; // the value of the selection
143 ChkTok (obj1);
144 StorVal ();
145 }
146 } else
147 if (obj.type == "select-multiple") { //one or more
148 for (j=0; j<obj.options.length; j++) { // run all options
149 if (obj.options[j].selected) {
150 val = obj.options[j].value; // selected value (default)
151 ChkTok (obj1);
152 StorVal ();
153 }
154 }
155 } else
156 if ((obj.type == "text" || // just read text,
157 obj.type == "textarea") &&
158 obj.name != "tot" && // but not from here
159 obj.name != "quantity") {
160 val = obj.value; // get the data
161 if (val == "" && tst) { // force an entry
162 alert ("Enter data for " + obj.id);
163 return false;
164 }
165 StorVal ();
166 }
167 }
168 // Now summarize stuff we just processed, above
169 if (op1a.length > 0) obj1.on0.value = op1a;
170 if (op1b.length > 0) obj1.os0.value = op1b;
171 if (op2a.length > 0) obj1.on1.value = op2a;
172 if (op2b.length > 0) obj1.os1.value = op2b;
173 if (op3a.length > 0) obj1.on2.value = op3a;
174 if (op3b.length > 0) obj1.os2.value = op3b;
175 if (op4a.length > 0) obj1.on3.value = op4a;
176 if (op4b.length > 0) obj1.os3.value = op4b;
177 if (op5a.length > 0) obj1.on4.value = op5a;
178 if (op5b.length > 0) obj1.os4.value = op5b;
179 if (op6a.length > 0) obj1.on5.value = op6a;
180 if (op6b.length > 0) obj1.os5.value = op6b;
181 if (op7a.length > 0) obj1.on6.value = op7a;
182 if (op7b.length > 0) obj1.os6.value = op7b;
183 if (op8a.length > 0) obj1.on7.value = op8a;
184 if (op8b.length > 0) obj1.os7.value = op8b;
185 if (op9a.length > 0) obj1.on8.value = op9a;
186 if (op9b.length > 0) obj1.os8.value = op9b;
187 if (itmn.length > 0) obj1.item_number.value = itmn;
188 obj1.item_name.value = des;
189 obj1.amount.value = Dollar (amt);
190 if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
191 }
192 //-->
193 </script>
194 <!-- End of Script -->
195 </head>
196
197
198
199 <body>
200
201 Widget Flower Bouquet
202 <!-- Start of Form -->
203 <!-- Note: target="paypal" was replaced with the variable target="_self" -->
204 <!-- Note: shopping_url also added to code -->
205 <!-- These two changes allow better functionality with IE and Firefox -->
206 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="this.target = '_self'; return ReadForm(this, true);">
207 <input type="hidden" name="add" value="1">
208 <input type="hidden" name="cmd" value="_cart">
209 <!--your email address goes here -->
210 <input type="hidden" name="business" value="youremail@youremail.com">
211 <input type="hidden" name="item_name">
212 <input type="hidden" name="item_number" "WFB-1001">
213 <input type="hidden" name="amount">
214 <input type="hidden" name="currency_code" value="USD">
215 <input type="hidden" name="lc" value="US">
216 <input type="hidden" name="shopping_url" value="http://www.yourwebsite.com/your_page.html">
217 <input type="hidden" name="cancel_return" value="http://www.yourwebsite.com/Cancel.html">
218 <input type="hidden" name="return" value="http://www.yourwebsite.com">
219 <input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
220
221
222 <!-- -->
223 <input type="hidden" name="baseamt" value="00">
224 <input type="hidden" name="basedes" value="Widget Flower Bouquet">
225 <!-- -->
226 <input type="hidden" name="baseon0" value="Requested Delivery Date">
227 <input type="hidden" name="baseos0">
228 <input type="hidden" name="baseon1" value="Deliver To">
229 <input type="hidden" name="baseos1">
230 <input type="hidden" name="baseon2" value="Phone">
231 <input type="hidden" name="baseos2">
232 <input type="hidden" name="baseon3" value="Address">
233 <input type="hidden" name="baseos3">
234 <input type="hidden" name="baseon4" value="Town/City">
235 <input type="hidden" name="baseos4">
236 <input type="hidden" name="baseon5" value="From">
237 <input type="hidden" name="baseos5">
238 <input type="hidden" name="baseon6" value="Sender Email">
239 <input type="hidden" name="baseos6">
240 <input type="hidden" name="baseon7" value="Sender Phone">
241 <input type="hidden" name="baseos7">
242 <input type="hidden" name="baseon8" value="Message">
243 <input type="hidden" name="baseos8">
244 <input type="hidden" name="baseitn">
245 <!-- -->
246 <input type="hidden" name="on0">
247 <input type="hidden" name="os0">
248 <input type="hidden" name="on1">
249 <input type="hidden" name="os1">
250 <input type="hidden" name="on2">
251 <input type="hidden" name="os2">
252 <input type="hidden" name="on3">
253 <input type="hidden" name="os3">
254 <input type="hidden" name="on4">
255 <input type="hidden" name="os4">
256 <input type="hidden" name="on5">
257 <input type="hidden" name="os5">
258 <input type="hidden" name="on6">
259 <input type="hidden" name="os6">
260 <input type="hidden" name="on7">
261 <input type="hidden" name="os7">
262 <input type="hidden" name="on8">
263 <input type="hidden" name="os8">
264 <input type="hidden" name="on9">
265 <input type="hidden" name="os9">
266 <!-- -->
267
268 <!-- -->
269 Select Size:&nbsp;&nbsp;
270 <select name="Size" onchange="ReadForm (this.form, false);">
271 <option value="Please Choose" selected>Please Choose</option>
272 <option value="Small @25.00">Small - $25.00</option>
273 <option value="Medium @30.00">Medium - $30.00</option>
274 <option value="Large @35.00">Large - $35.00</option>
275 </select>
276 <!-- -->
277 <br><br>
278
279 <!-- Start of Options -->
280 Extras:
281 <br><br>
282 <input type = "checkbox"
283 onclick = "ReadForm (this.form, false);"
284 value = "Wrapper Package +5.00">
285 Hand Tied Ribbon and Bow Wrapper Package - $5.00
286 &nbsp;
287 <br><br>
288 <input type = "checkbox"
289 onclick = "ReadForm (this.form, false);"
290 value = "Chocolates Bites +9.00">
291 1 Lb Box Homemade Dark Chocolates Bites - $9.00
292 &nbsp;
293 <!-- End of Options -->
294
295 <!-- Start of Text Input Fields -->
296 <br><br>
297 Requested Delivery Date:&nbsp;&nbsp;
298 <input type="text" id="Requested Delivery Date" name="deliverydate_1b" size="10">
299 <!-- -->
300 <br><br>
301 Deliver To:&nbsp;&nbsp;
302 <input type="text" id="Deliver To" name="deliverto_2b" size="20">
303 <!-- -->
304 <br><br>
305 Phone:&nbsp;&nbsp;
306 <input type="text" id="Phone" name="phone_3b" size="12">
307 <!-- -->
308 <br><br>
309 Address:&nbsp;&nbsp;
310 <input type="text" id="Address" name="address_4b" size="20">
311 <!-- -->
312 <br><br>
313 Town/City:&nbsp;&nbsp;
314 <input type="text" id="Town/City" name="towncity_5b" size="20">
315 <!-- -->
316 <br><br>
317 From:&nbsp;&nbsp;
318 <input type="text" id="From" name="from_6b" size="20">
319 <!-- -->
320 <br><br>
321 Your Email:&nbsp;&nbsp;
322 <input type="text" id="Your Email" name="semail_7b" size="20">
323 <!-- -->
324 <br><br>
325 Your Phone:&nbsp;&nbsp;
326 <input type="text" id="Your Phone" name="sphone_8b" size="12">
327 <!-- -->
328 <br><br>
329 Message:&nbsp;&nbsp;
330 <input type="text" id="Message" name="message_9b" size="30">
331 <!-- End of Text Input Fields -->
332
333
334 <br><br><br>
335
336 Total Cost:&nbsp; &nbsp;
337 <input class="nbor" type="text" name="tot" size="8" value="$0.00">
338
339 <br><br>
340
341 <input type = "button"
342 value = "Reset FORM"
343 onclick = "this.form.reset();">
344
345 <br><br>
346
347
348
349 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" name="submit" alt="cart add">
350 </form>
351 <!-- End of Form -->
352
353 </body>
354 </html>