Hello,
Scripting isn’t my thing, but I’m trying by using and combining scripts.
[b] :-\ Can somebody help me, I’ve tried to work around this problem for days. :-[/b]
I need to calculate a total out of a session with the total shipping costs.
This are “ totaal” and “products” . and need 2 decimals (money).
The first part works:
[php]function selectedValue(v) { return (v.selectedIndex < 0) ? 0 : parseFloat(v[v.selectedIndex].value);}
function BerekenTotaal() {
var f = document.VerzendKosten;
var totaal = (selectedValue(f.landverz) + selectedValue(f.trackentrace)).toFixed(2);
f.totaaltext.value = totaal [/php]
When I use the second part it will put the two values behind each other
(Value 1 = 19.30) + (Value 2 = 425) = (Total = 19.30425) ???
[php]products = document.getElementById(‘subtotaal’).value;
uitkomst = totaal + products;
document.getElementById(‘ordertotal’).value = uitkomst;[/php]
The partial working code of the form:
[php]<?php
// Session
include("./inc/session.php");
?>
<?php
// URL
include("./weergeven/url.php");
?>
Bestel formulier
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bold;
}
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
–>
Bestelformulier
|
<tr><td colspan=2 width="100%"><hr><span class="style1">Verzendkosten:</span>
Uw land:
-----------------------Kies ------------------------------------------
Albanië
Andora
Azoren
België
Bosnië-Herzegovina
Bulgarije
Canarische Eilanden
Corsica
Cyprus
Denemarken (Excl. Faeröer Eilanden en Groenland)
Duitsland
Engeland
Estland
Faeröer Eilanden
Finland
Frankrijk (Incl. Carsica en Monaco))
Gibraltar
Griekenland
Guernsey
Hongarije
Ierland
IJsland
Italië (Excl. San Marino en Vaticaanstad)
Jersey
Kroatië
Letland
Luxemburg
Madeira
Malta
Moldavië
Monaco
Montenegro
Nederland
Noorwegen
Oekraïne
Oostenrijk
Polen
Portugal (Incl. Azoren en Madeira)
Roemenie
San Marino
Servië
Slovenië
Slowakije
Spanje (Incl. Balearen, exclusief Canarische eilanden)
Tsjechië
Turkije
Vaticaanstad
Verenigd Koninkrijk (Excl. Gibraltar en Kanaaleilanden)
Wit-Rusland
Zweden
Zwitserland
Verzend opties:
-----------------------Kies ------------------------------------------
Track & Trace
Verzekerd (500,- Euro)
Verzekerd (5.500,- Euro)
|
Verzendkosten : €
|
<tr>
<td colspan=2 valign="bottom"><hr></td>
</tr>
<tr>
<td bgcolor=green valign="bottom"><span class="style1">
Totaal
</span></td>
<td bgcolor=yellow align="right"><span class="style1">
<input id="ordertotal" type="text" readonly="readonly" maxlength="8" size="4" tabindex="1" name="1" value="0" align="right">
</span></td>
</tr>
<input type=“hidden” name=“ip” id=“ip” value="<?php $ip=@$REMOTE_ADDR; echo "$ip"; ?>" />
|
[/php]
Thanks,
Rob