-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavascript.html
More file actions
63 lines (59 loc) · 2.41 KB
/
Copy pathJavascript.html
File metadata and controls
63 lines (59 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
var bezorgkosten = 15;
var klantnaam = prompt("voer je eigen naam in");
var aantal = parseInt(prompt("aantal boeken bestellen?"));
var woonplaats = prompt("Wat is uw woonplaats: ");
var postcode = prompt("Wat is uw Postcode: ");
var postcodeC = Number(postcode.slice(0,4));
var postcodeL = postcode.slice(-2).toUpperCase();
var correctstad = woonplaats.toLowerCase() === 'amsterdam';
var inpostcode = postcodeC >= 1000 && postcodeC <= 2000 && postcodeL >='AA' && postcodeL <= 'BB';
if(correctstad && inpostcode) {
alert("U betaalt geen bezorgkosten")
bezorgkosten = 0;
} else{
alert("de verzendkosten zijn €: " + bezorgkosten)
}a
var title = "JavaScript";
var prijs = 29.90;
var bedrag = prijs * aantal;
var btw = bedrag / 100 * 6;
var totaalPlusBtw = bedrag + btw;
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
var Betaaldatum = today.getDate() + 5;
if (dd < 10) {
dd = '0' + dd;
Betaaldatum = '0' + Betaaldatum;
}
if (mm < 10) {
mm = '0' + mm;
}
var today = dd + '/' + mm + '/' + yyyy;
var Betaaltoday = Betaaldatum + '/' + mm + '/' + yyyy;
document.write("<br>Factuurdatum: " + today);
document.write("<br>Betaaldatum: " + Betaaltoday)
document.write("<br>Bedankt voor je bestelling: " + klantnaam);
document.write("<br>Woonplaats: " + woonplaats);
document.write("<br>PostCode: " + postcode);
document.write("<br>Boektitle: " + title);
document.write("<br>Aantal te bestellen: " + aantal);
document.write("<br>Prijs per boek is: " + prijs.toFixed(2));
document.write("<br>Totaal exclusief BTW is: " + bedrag.toFixed(2));
document.write("<br>BTW: " + btw.toFixed(2));
document.write("<br>Totaal inclusief BTW is: " + totaalPlusBtw.toFixed(2));
totaalPrijs = totaalPlusBtw + bezorgkosten;
document.write("<br>Bezorgkosten " + bezorgkosten);
document.write("<br>Totaal inclusief BTW en bezorgkosten: " + totaalPrijs.toFixed(2));
</script>
</body>
</html>