-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.js
36 lines (26 loc) · 1.17 KB
/
address.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
var savedaddress=JSON.parse(localStorage.getItem("adddata"))||[];
document.getElementById("addbutton").addEventListener("click",function(){saveaddressinstorage()});
function saveaddressinstorage(){
var somedata={
name:document.getElementById("name").value,
mobile:document.getElementById("mobile").value,
pin:document.getElementById("pin").value,
house:document.getElementById("house").value,
local:document.getElementById("local").value,
incity:document.getElementById("incity").value,
insatte:document.getElementById("instate").value,
}
savedaddress.push(somedata);
localStorage.setItem("adddata",JSON.stringify(savedaddress));
}
var cartdata=JSON.parse(localStorage.getItem("cartdata"))
var totalmrpsum='';
totalmrpsum="3000*"+cartdata.length;
document.querySelector("#totalmrp").append(eval(totalmrpsum))
var totaldiscount=[];
for(var i=0;i<cartdata.length;i++){
totaldiscount.push(eval("-"+cartdata[i].price))
}
document.querySelector("#discountmrp").append(eval(totaldiscount.join('')))
var final=eval(totalmrpsum)+eval(totaldiscount.join(''));
document.querySelector("#totalamount").append(eval(final))