forked from daniyal4engg/expedia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment.js
88 lines (80 loc) · 2.67 KB
/
payment.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var form = document.querySelector("#form");
form.addEventListener("submit", addData);
var arr = JSON.parse(localStorage.getItem("Member")) || [];
function addData(event) {
event.preventDefault();
var form = document.querySelector("#form");
// var fname = document.getElementById("firstname").value;
// var sname = document.getElementById("surname").value;
// var output = document.getElementById("output").value;
// console.log(form.firstname.value);
var obj = {
fname: form.firstname.value,
sname: form.surname.value,
mob_no: form.output.value,
country: form.country.value,
};
// console.log(obj);
arr.push(obj);
// console.log(arr);
arr = JSON.stringify(arr);
localStorage.setItem("Member", arr);
displayreceipt(arr);
}
function displayreceipt(arr) {
document.querySelector("tbody").innerHTML = "";
arr.map(function (elem) {
var tr = document.createElement("tr");
var td1 = document.createElement("td");
var td2 = document.createElement("td");
var td3 = document.createElement("td");
var tbody = document.querySelector("tbody");
tbody.appendChild(tr);
tr.append(td1, td2, td3);
td1.textContent = elem.fname;
td2.textContent = elem.sname;
td3.textContent = elem.country;
});
}
function country_code() {
var countryVal = document.getElementById("country").value;
var country = document.getElementById("country");
var outputVal = document.getElementById("output");
if (countryVal === "Select_Country") {
document.getElementById("output").value = "";
} else if (countryVal === "IND" || countryVal === "ind") {
document.getElementById("output").value = "+91-";
changes();
} else if (countryVal === "US" || countryVal === "us") {
document.getElementById("output").value = "+1-";
changes();
} else if (countryVal === "UK" || countryVal === "uk") {
document.getElementById("output").value = "+55-";
changes();
}
function changes() {
country.style.color = "#08f";
outputVal.style.color = "#08f";
country.style.border = "black";
}
}
// console.log(form.firstname.value);
function showindow() {
alert(
"If you change or cancel your booking you will not get a refund or credit to use for a future stay. This policy will apply regardless of COVID-19, subject to any local consumer laws."
);
}
function show_month() {
console.log(document.getElementById("expMonth").value);
}
function show_year() {
console.log(document.getElementById("expYear").value);
}
// document.getElementById("booking_done").addEventListner("click" function(){
// })
function clickcomplete() {
window.location.href = "receipt.html";
}
function goHome() {
window.location.href = "home.html";
}