Preisrechnung via JQuery, Problem

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Preisrechnung via JQuery, Problem

    Hallöchen,

    ich habe hier einiges zusammen geschrieben, nur es will einfach nicht funktionieren bzw. zusammen rechnen! Kann man mir vielleicht in Sachen JQuery helfen? Denn ich habe seit 3 Tagen rum geschrieben aber ich bekam es nicht hin. Ich bedanke mich schon mal im Voraus ;)

    Quellcode

    1. <!DOCTYPE html>
    2. <style type="text/css">
    3. <!--
    4. .moep {
    5. font-size: 9px;
    6. font-family: "Droid Sans", "Helvetica Neue", Helvetica, sans-serif;
    7. color: #999;
    8. }
    9. .good {
    10. font-size: 13px;
    11. font-family: "Droid Sans", "Helvetica Neue", Helvetica, sans-serif;
    12. }
    13. .überschrift {
    14. font-family: "Droid Sans", "Helvetica Neue", Helvetica, sans-serif;
    15. }
    16. .artikel {
    17. font-size: 12px;
    18. font-family: "Droid Sans", "Helvetica Neue", Helvetica, sans-serif;
    19. color: #FFF;
    20. font-weight: bold;
    21. }
    22. -->
    23. </style>
    24. <head>
    25. <script type="text/javascript">
    26. function createprice(){
    27. var fullp = 11.90;
    28. var months = 0;
    29. if (document.getElementById("varid0").value == 689) {
    30. months = 2;
    31. }
    32. if (document.getElementById("varid0").value == 1166) {
    33. months = 3;
    34. }
    35. if (document.getElementById("varid0").value == 689) {
    36. var perid0 = -5.00;
    37. }
    38. if (document.getElementById("varid0").value == 1166) {
    39. var perid0 = -7.50;
    40. }
    41. perprice = perid0;
    42. calcprice = fullp + 0;
    43. calcprice = calcprice * perprice / 100 + calcprice;
    44. if (months > 1) {
    45. calcprice = calcprice * months;
    46. }
    47. if (calcprice <= 0) {
    48. var obj = document.getElementById("shopbutton");
    49. obj.className = "close";
    50. }else{
    51. var obj = document.getElementById("shopbutton");
    52. obj.className = "open";
    53. }
    54. calcprice = calcprice.toFixed(2);
    55. calcprice = calcprice.replace(".",",");
    56. document.cprice.moneytotal.value = calcprice + " €" + " inkl. MwSt.";
    57. }
    58. function createonetime(){
    59. var fullp = 0;
    60. if (document.getElementById("varid1").value == 690) {
    61. var varid0 = 0.00;
    62. }
    63. perprice = 0;
    64. calcprice = fullp + varid0;
    65. calcprice = calcprice * perprice / 100 + calcprice;
    66. calcprice = calcprice.toFixed(2);
    67. calcprice = calcprice.replace(".",",");
    68. document.cprice.moneyonetime.value = calcprice + " €" + " inkl. MwSt.";
    69. }
    70. </script>
    71. </head>
    72. <body>
    73. <table width="50%">
    74. <tr>
    75. <td><table width="700">
    76. <tr>
    77. <td valign="bottom" class="überschrift"><br>
    78. <h2>Counter-Strike Source<br>Clan/War Server</h2></td>
    79. </tr>
    80. <tr>
    81. <td><table width="100%">
    82. <tr>
    83. <td width="102" align="center" bgcolor="#2e709e" class="artikel">Artikel-Nr.: 10651</td>
    84. <td width="348">&nbsp;</td>
    85. <td width="250">&nbsp;</td>
    86. </tr>
    87. </table>
    88. </td>
    89. </tr>
    90. <tr>
    91. <td><table width="700">
    92. <tr>
    93. <td class="good" width="180">&nbsp;</td>
    94. <td width="520">&nbsp;</td>
    95. </tr>
    96. <tr>
    97. <td width="180">&nbsp;</td>
    98. <td width="520">&nbsp;</td>
    99. </tr>
    100. <tr>
    101. <td class="good" width="180"><span Style="color:#F00;">*</span>&nbsp;Vollst&auml;ndiger Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    102. <td width="520"><table width="100%">
    103. <tr>
    104. <td width="180"><input name="Nachname" type="text" size="25" maxlength="40"></td>
    105. <td width="340"><input name="Vorname" type="text" size="25" maxlength="40"></td>
    106. </tr>
    107. </table></td>
    108. </tr>
    109. <tr>
    110. <td width="180">&nbsp;</td>
    111. <td width="520"><table width="100%">
    112. <tr>
    113. <td width="185" valign="top" class="moep">&nbsp;Nachname</td>
    114. <td width="320" valign="top" class="moep">&nbsp;&nbsp;Vorname</td>
    115. </tr>
    116. </table></td>
    117. </tr>
    118. <tr>
    119. <td width="180">&nbsp;</td>
    120. <td width="520">&nbsp;</td>
    121. </tr>
    122. <tr>
    123. <td class="good" width="180"><span Style="color:#F00;">*</span>&nbsp;Anschrift:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    124. <td width="520"><table width="100%">
    125. <tr>
    126. <td width="285"><input name="Straße" type="text" size="44" maxlength="40"></td>
    127. <td width="220"><input name="Hausnummer" type="text" size="6" maxlength="5"></td>
    128. </tr>
    129. </table></td>
    130. </tr>
    131. <tr>
    132. <td width="180">&nbsp;</td>
    133. <td width="520"><table width="100%">
    134. <tr>
    135. <td width="295" valign="top" class="moep">&nbsp;Stra&szlig;e</td>
    136. <td width="205" valign="top" class="moep">&nbsp;&nbsp;Hausnr.</td>
    137. </tr>
    138. </table>
    139. </tr>
    140. <tr>
    141. <td class="good" width="180">&nbsp;</td>
    142. <td width="520"><table width="100%">
    143. <tr>
    144. <td width="73"><input name="PLZ" type="text" size="6" maxlength="10"></td>
    145. <td width="125"><input name="Stadt" type="text" size="15" maxlength="40"></td>
    146. <td width="297"><select name="Länder">
    147. <option value="Deutschland">Deutschland</option>
    148. <option value="Österreich">&Ouml;sterreich</option>
    149. <option value="Schweiz">Schweiz</option>
    150. <option value="anderes">anderes</option>
    151. </select>
    152. </td>
    153. </tr>
    154. </table></td>
    155. </tr>
    156. <tr>
    157. <td width="180">&nbsp;</td>
    158. <td width="520"><table width="100%">
    159. <tr>
    160. <td width="70" valign="top" class="moep">&nbsp;Postleitzahl</td>
    161. <td width="125" valign="top" class="moep">&nbsp;&nbsp;Stadt</td>
    162. <td width="300" valign="top" class="moep">&nbsp;&nbsp;Land</td>
    163. </tr>
    164. </table></td>
    165. </tr>
    166. <tr>
    167. <td width="180">&nbsp;</td>
    168. <td width="520">&nbsp;</td>
    169. </tr>
    170. <tr>
    171. <td class="good" width="180"><span Style="color:#F00;">*</span>&nbsp;e-Mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    172. <td><table width="520">
    173. <tr>
    174. <td><input name="email" type="text" size="25" maxlength="40"></td>
    175. </tr>
    176. </table></td>
    177. </tr>
    178. <tr>
    179. <td width="180">&nbsp;</td>
    180. <td width="520">&nbsp;</td>
    181. </tr>
    182. <tr>
    183. <td class="good" width="180"><span Style="color:#F00;">*</span>&nbsp;Vertragsart:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    184. <td><table width="520">
    185. <tr>
    186. <td><select name="VArten">
    187. <option value="Prepaid">Prepaid (Keine Vertragsbindung)</option>
    188. </select>
    189. </td>
    190. </tr>
    191. </table></td>
    192. </tr>
    193. <tr>
    194. <td class="good" width="180">&nbsp;&nbsp;Vorauszahlung:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    195. <td><table width="520">
    196. <tr>
    197. <td><select name="varid[]" id="varid0" class="selectfield" onchange="createprice()">
    198. <option value="VZ1">1 Monat (0.00&nbsp;%)</option>
    199. <option value="689">2 Monate&nbsp;(5,00&nbsp;%)</option>
    200. <option value="1166">3 Monate&nbsp;(-7,50&nbsp;%)</option>
    201. </select>
    202. </td>
    203. </tr>
    204. </table></td>
    205. </tr>
    206. <tr>
    207. <td class="good" width="180"><span Style="color:#F00;">*</span>&nbsp;Zahlungsarten:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    208. <td><table width="520">
    209. <tr>
    210. <td><select name="VZahlung">
    211. <option value="ZA1">Bank-&Uuml;berweisung</option>
    212. <option value="ZA2">Paypal</option>
    213. <option value="ZA3">Paysafe Card</option>
    214. </select>
    215. </td>
    216. </tr>
    217. </table></td>
    218. </tr>
    219. <tr>
    220. <td width="180">&nbsp;</td>
    221. <td width="520">&nbsp;</td>
    222. </tr>
    223. <tr>
    224. <td class="good" width="180">&nbsp;&nbsp;Einrichtungsgeb&uuml;hr:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    225. <td><table width="520">
    226. <tr>
    227. <td><select name="varid[]" id="varid1" class="selectfield" onchange="createonetime()">
    228. <option value="690">Keine Einrichtungsgeb&uuml;hr&nbsp;(0,00&nbsp;&euro;)</option></select></td>
    229. </tr>
    230. </table></td>
    231. </tr>
    232. <tr>
    233. <td width="180">&nbsp;</td>
    234. <td width="520">&nbsp;</td>
    235. </tr>
    236. <tr>
    237. <td width="180">&nbsp;</td>
    238. <td width="520">&nbsp;</td>
    239. </tr>
    240. <tr>
    241. <td>&nbsp;</td>
    242. <td>&nbsp;</td>
    243. </tr>
    244. <tr>
    245. <td class="good" width="180">&nbsp;&nbsp;Einmalige Geb&uuml;hren:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    246. <td width="520"><input type="text" name="moneyonetime" style="border:0px solid;background:none;width:150px;" value="0,00 &euro;&nbsp;inkl. MwSt."></td>
    247. </tr>
    248. <tr>
    249. <td class="good" width="180">&nbsp;&nbsp;<b>Gesamtpreis:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    250. <td width="520"><input type="text" name="moneytotal" style="border:0px solid;background:none;width:150px;" value="11,90 &euro;&nbsp;inkl. MwSt."></td>
    251. </tr>
    252. <tr>
    253. <td>&nbsp;</td>
    254. <td>&nbsp;</td>
    255. </tr>
    256. <tr>
    257. <td>&nbsp;</td>
    258. <td>&nbsp;</td>
    259. </tr>
    260. <tr>
    261. <td>&nbsp;</td>
    262. <td>&nbsp;</td>
    263. </tr>
    264. </table></td>
    265. </tr>
    266. </table></td>
    267. </tr>
    268. </table>
    269. </body>
    270. </html>
    Alles anzeigen