diff --git a/2darray.html b/2darray.html new file mode 100644 index 0000000..399ea59 --- /dev/null +++ b/2darray.html @@ -0,0 +1,17 @@ + + + + + + Document + + + +
+ + +
+ + + + \ No newline at end of file diff --git a/arrayFunction.html b/arrayFunction.html new file mode 100644 index 0000000..e6cfa86 --- /dev/null +++ b/arrayFunction.html @@ -0,0 +1,12 @@ + + + + + + Document + + + + + + \ No newline at end of file diff --git a/css/hotelbill.css b/css/hotelbill.css new file mode 100644 index 0000000..e5c098d --- /dev/null +++ b/css/hotelbill.css @@ -0,0 +1,90 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-image: url(/image/restaurant-interior.jpg); + background-size: cover; +} + +.box { + margin: auto; + margin-top: 2%; + padding: 2%; + background-image: url(/image/Screenshot\ 2023-10-08\ 124757.png); + background-size: cover; + background-position: center center; + width: 30%; + /* background-color: rgb(0, 202, 114); */ + border-radius: 20px; +} + +h1 { + font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + font-style: italic; + font-size: larger; + color: rgb(28, 163, 48); + padding: 9px; +} + +p { + color: red; + font-size: small; + font-family: serif; + padding: 4px; +} + +input { + padding: 7px; + border-radius: 10px; + border-style: none; + background-color: rgb(246, 255, 0); + color: rgb(0, 142, 26); +} + +select { + background-color: rgb(246, 255, 0); + color: rgb(0, 142, 26); + padding: 7px; + border-radius: 10px; + border-style: none; +} + +#submit { + color: rgb(0, 103, 43); + background-color: rgb(0, 255, 68); +} + +table { + background-color: rgb(248, 149, 0); + border-radius: 10px; + border-style: none; +} + +th { + color: rgb(31, 116, 87); + background-color: rgb(109, 210, 0); + border-radius: 10px; + padding: 5px; + border-style: none; + +} + +td { + color: rgb(31, 116, 87); + background-color: rgb(109, 210, 0); + border-radius: 10px; + padding: 5px; + border-style: none; +} + +button { + color: rgb(185, 194, 191); + background-color: rgb(210, 25, 0); + border-radius: 10px; + padding: 5px; + border-style: none; +} + diff --git a/dom.html b/dom.html new file mode 100644 index 0000000..26377aa --- /dev/null +++ b/dom.html @@ -0,0 +1,22 @@ + + + + + + Document + + + + +
+ + + +
+
+ +
+ + + + \ No newline at end of file diff --git a/h2.html b/h2.html new file mode 100644 index 0000000..4a7658d --- /dev/null +++ b/h2.html @@ -0,0 +1,69 @@ + + + + + + + Document + + + + + +
+
+

HOTEL BILL COLLECTION SYSTEM

+
+ +

+

Select Table :-

+ +

+

Food:-

+ + +

+ +

No.OF Parson:-

+ +

+


+ + +

+
+ + + + + + + + + + +
Sr No.DateTableFoodNo.Of ParsonTotal BillAction
+
+ +
+ + + + \ No newline at end of file diff --git a/hotelbill.html b/hotelbill.html new file mode 100644 index 0000000..d56a332 --- /dev/null +++ b/hotelbill.html @@ -0,0 +1,69 @@ + + + + + + + Document + + + + + +
+
+

HOTEL BILL COLLECTION SYSTEM

+
+ +

+

Select Table :-

+ +

+

Food:-

+ + +

+ +

No.OF Parson:-

+ +

+


+ + +

+
+ + + + + + + + + + +
Sr No.DateTableFoodNo.Of ParsonTotal BillAction
+
+ +
+ + + + \ No newline at end of file diff --git a/image/2307-w064-n002-541B-p1-541.jpg b/image/2307-w064-n002-541B-p1-541.jpg new file mode 100644 index 0000000..f565c85 Binary files /dev/null and b/image/2307-w064-n002-541B-p1-541.jpg differ diff --git a/image/427230-PDYP34-121.jpg b/image/427230-PDYP34-121.jpg new file mode 100644 index 0000000..d781993 Binary files /dev/null and b/image/427230-PDYP34-121.jpg differ diff --git a/image/Screenshot 2023-10-08 124757.png b/image/Screenshot 2023-10-08 124757.png new file mode 100644 index 0000000..a3039ed Binary files /dev/null and b/image/Screenshot 2023-10-08 124757.png differ diff --git a/image/restaurant-interior.jpg b/image/restaurant-interior.jpg new file mode 100644 index 0000000..47b4f25 Binary files /dev/null and b/image/restaurant-interior.jpg differ diff --git a/js/2darray.js b/js/2darray.js new file mode 100644 index 0000000..43314f2 --- /dev/null +++ b/js/2darray.js @@ -0,0 +1,21 @@ +let arr = [ + [1,'meet',21] + [2,'dixit',20] + [3,'dhruvil',22] +] + +const display = (arr) => { + + let print = '' + + + for (let i=0; i { // console.log(index + '--' + value); // }); -//3. +// 3. // data.map((value,index) => { // console.log(index + '--' + value); // }) -//4. +// 4. // data.map((v,i) => console.log(i + '--' + v)) @@ -145,7 +145,7 @@ // --Update-- -//1. +// 1. // data[3] = 50 // console.log(data); @@ -157,19 +157,19 @@ // --Add-- -//1. +// 1. // data.push(100); // console.log(data); -//2. +// 2. // data.unshift(100); // console.log(data); -//3. +// 3. // data.splice(5,0,87) // console.log(data); @@ -179,65 +179,65 @@ // --Remove-- -//1. +// 1. // data.pop() // console.log(data); -//2. +// 2. // data.shift() // console.log(data); -//3. +// 3. // data.splice(2,3) // console.log(data); -//------------- +// ------------- // let data = [ 30, 5, 'MISTRY', 80, 60, 'Surti', 50 ]; // let data1 = [88,188]; -//------------- +// ------------- // --Array's Function's-- -//1. +// 1. // let ans = Array.isArray(data); // console.log(ans); -//2. +// 2. // let ans = data.concat(data1) // console.log(ans); -//3. +// 3. // let ans = data.some((v) => v > 50); // console.log(ans); -//4. +// 4. // let ans = data.find((v) => v > 20); // console.log(ans); -//5. +// 5. // let fullname = "MEET NILESHBHAI MISTRY"; // let ans = fullname.split(" "); // console.log(ans); -//6. +// 6. // let ans = data.slice(2,4 ); // console.log(ans); @@ -247,7 +247,7 @@ // -------TASK------- // ------------------ -//1. filter() +// 1. filter() // const Age = [25, 64, 16, 15, 34]; @@ -261,7 +261,7 @@ -//2. reduse() +// 2. reduse() // let arr = [200, 50, 25]; @@ -276,7 +276,7 @@ // callTask() //Ans: 125 - //or +// or @@ -298,7 +298,7 @@ -//3. indexOf() +// 3. indexOf() // function task() { @@ -318,7 +318,7 @@ -//4. lastindexOf +// 4. lastindexOf // function task() { // let lindexOf = 'mistrymeetteem'; @@ -353,17 +353,17 @@ // console.log(ans); -//2.filter +// 2.filter // let ans = data.filter((v,i) => v > 15 && v < 90) // console.log(ans); -//3. reduse +// 3. reduse // let ans = data1.reduce((acc,v,i) => acc + v,0) // console.log(ans); -//4. reverse +// 4. reverse // let ans = data.reverse() // console.log(ans); @@ -371,58 +371,131 @@ -//5. sort +// 5. sort -//1 +// 1 // let ans = data2.sort() // console.log(ans); //asc -//2 +// 2 // let ans = data1.sort((a,b) => a - b) // console.log(ans); -//3 +// 3 // let ans = data1.sort((a,b) => b - a) // console.log(ans); -//6.fill +// 6.fill // let ans = data.fill(10000,2,5) // console.log(ans); -//7.findIndex +// 7.findIndex // let ans = data1.findIndex((v) => v === 56) // console.log(ans); -let data = [ 10, 8, 50, 'meet', 40, 80, 90, 'meet' ]; +// let data = [ 10, 8, 50, 'meet', 40, 80, 90, 'meet' ]; -let data1 = [55, 8, 9, 877, 56, 99, 140]; +// let data1 = [55, 8, 9, 877, 56, 99, 140]; + +// let data2 = ['Mistry','Meet','Surati','Gujarati']; + + +// //8.includes + +// // let ans = data1.includes(55) +// // console.log(ans); + +// //9.every + +// // let ans = data1.every((v) => v > 0) +// // console.log(ans); + + +// //10. indexOf + +// // let ans = data.indexOf("meet") +// // console.log(ans); + + +// let ans = data.lastIndexOfayyays("meet") +// console.log(ans); + + + + + +// -----arrays task--------- +// ------------------------- + + + +// let data = [20, 49, 10, 'meet', 58, 79]; + +// let data1 = [39, 58, 88, 19, 95, 68] + +// let data2 = ['surat','mumbai','panjab','tamilnadu'] -let data2 = ['Mistry','Meet','Surati','Gujarati']; +// // 1. Finding the maximum element in an array. +// let ans = data.filter((v, i) => v > 40) +// console.log(ans); + +// or + +// let ans1 = data.filter((v, i) => { +// if (v > 15) { +// console.log(v); +// } +// }) + + + + +// 2. Finding the minimum element in an array. + + +// let ans = data.filter((v, i) => v < 50) +// console.log(ans); -//8.includes -// let ans = data1.includes(55) +// or + + +// let ans1 = data.filter((v, i) => { +// if (v < 15) { +// console.log(v); +// } +// }) + + + +// 3. Sorting an array in ascending order + +// let ans = data2.sort() // console.log(ans); -//9.every +// or -// let ans = data1.every((v) => v > 0) +// let ans = data2.sort((v,i) => v - i ) // console.log(ans); -//10. indexOf -// let ans = data.indexOf("meet") + + +// 4. Sorting an array in descending order. + +// let ans = data1.sort((v,i) => i - v) // console.log(ans); +// or -let ans = data.lastIndexOfayyays("meet") -console.log(ans); +// let ans = data.sort() +// console.log(ans); \ No newline at end of file diff --git a/js/arrayFunction.js b/js/arrayFunction.js new file mode 100644 index 0000000..1f09a70 --- /dev/null +++ b/js/arrayFunction.js @@ -0,0 +1,181 @@ +// let array1 = [15, 84, 65, 22, 45, 170, 54] + +//1. + +// const maxArr = (array1) => { +// let max = array1[0] + +// for (let i=1; i max) { +// max = array1[i] +// } +// } +// console.log(max); +// } +// maxArr(array1) + + + +//2. + +// const maxArr = (array1) => { +// let max = array1[0] + +// for (let i=1; i { +// let = newArr =[] +// for (let i=array1.length-1; i>=0; i--) { +// newArr.push(array1[i]); +// } +// console.log(newArr); +// } + +// ReversArr(array1) + +//6. Finding the sum of all elements in an array. + +// const SumArr = () => { +// sum = 0 +// for (let i=0; i { +// sum = 0 +// for (let i=0; i { +// let temp; +// for (let i=0; i { +// let uniqeArr = [] + +// arr.map((v) => { +// if (!uniqeArr === v) { +// newArr.push(v) +// } +// }) +// console.log(uniqeArr); +// } + +// dupliArr(arr2) + + + + + + +//10. Merging two arrays into a new array. + +// const mergeArr = (arr1,arr2) => { +// let newArr = [] + +// for (let i=0; i { + + +// } +// splitArr(arr1, aar2) + +//13. Rotating an array by a given number of positions. + +// const rotatingArr = (arr,n) => { +// for (let i=0; i { + +// let ans = arr.sort((a,b) => b-a) +// console.log(ans[1]); +// } + +// seclargArr(arr1) + +// 15. Finding the k-th smallest element in an array. + +// const ksmallArr = (arr, elem) => { +// let ans = arr.sort((a, b) =>a - b) +// console.log(ans[elem - 1]); +// } +// ksmallArr(arr1, 2) + diff --git a/js/dom.js b/js/dom.js new file mode 100644 index 0000000..8c7e86d --- /dev/null +++ b/js/dom.js @@ -0,0 +1,54 @@ +// const handlClick = () => { +// console.log("Click!!"); +// } +// let divElem = document.getElementById("disp"); +// let h1Elem = document.createElement("h1"); +// let h1Text = document.createTextNode("Hello"); + +// h1Elem.appendChild(h1Text); + +// divElem.appendChild(h1Elem); + +// let aElem = document.createElement("a"); +// aElem.setAttribute("href","#"); +// aElem.setAttribute("onclick","handlClick()") +// let aText = document.createTextNode("home"); + +// aElem.appendChild(aText); +// divElem.appendChild(aElem); + + +const handlRemove = (id) => { + let div = document.getElementById("div-", + id) + console.log("remove"); + div.remove() + +} +const handlSubmit = () => { + event.preventDefault() + + let name = document.getElementById("name").value; + console.log("ok"); + + let id = Math.floor(Math.random() * 1000); + console.log(id); + + + let parentDiv = document.getElementById("disp"); + let divElem = document.createElement("div"); + divElem.setAttribute("id","div-" + id); + let divText = document.createTextNode(name); + + let btnElem = document.createElement("button"); + btnElem.setAttribute("onclick","handlRemove("+ id +")"); + + let btnText = document.createTextNode("X"); + + divElem.appendChild(divText); + parentDiv.appendChild(divElem); + + btnElem.appendChild(btnText); + parentDiv.appendChild(btnElem); + + +} \ No newline at end of file diff --git a/js/h2.js b/js/h2.js new file mode 100644 index 0000000..1bb8cff --- /dev/null +++ b/js/h2.js @@ -0,0 +1,181 @@ +let update = null; +const handlesubmit = () => { + var date = document.getElementById("tdate").value; + var table = document.getElementById("table").value; + var fooddp = document.getElementById("food").value; + var nopar = document.getElementById("parson").value; + var food; + var id = Math.floor(Math.random() * 100); + let localdata = JSON.parse(localStorage.getItem("hoteldata")); + if (nopar == '' || date == '') { + event.preventDefault() + document.getElementById("error").innerHTML='Please Enter Parson '; + }else if(nopar <= 0){ + event.preventDefault() + document.getElementById("error").innerHTML='Invlade Parson'; + } else { + if(update == null){ + if (fooddp === "Panjabi") { + food = "Panjabi"; + rate = 250 * nopar; + } else if (fooddp === "Chinees") { + food = "Chinees"; + rate = 150 * nopar; + } else if (fooddp === "SouthIndian") { + food = "South-Indian"; + rate = 200 * nopar; + } + var obj={ + "id": id, + "Date": date, + "Table": table, + "Food": food, + "Parson": nopar, + "TotalBill": rate, + } + + if (localdata == null) { + localStorage.setItem("hoteldata", JSON.stringify([obj])); + } else { + localdata.push(obj); + localStorage.setItem("hoteldata", JSON.stringify(localdata)); + } + console.log("Data-Added"); + }else{ + if (fooddp == "Panjabi") { + food = "Panjabi"; + rate = 250 * nopar; + } else if (fooddp == "Chinees") { + food = "Chinees"; + rate = 150 * nopar; + } else if (fooddp == "SouthIndian") { + food = "South-Indian"; + rate = 200 * nopar; + } + let obj={ + id:update, + date, + table, + food, + nopar, + rate + } + let index = localdata.findIndex((v)=>v.id == update); + localdata[index]=obj; + localStorage.setItem("hoteldata", JSON.stringify(localdata)); + + window.location.reload() + } + update=null; + } + } + +const display = () => { + var localdata = JSON.parse(localStorage.getItem("hoteldata")); + + var tableref = document.getElementById("disp"); + + var finelbill = localdata.reduce((acc, v) => acc + v.TotalBill, 0); + + + localdata.map((v, i) => { + + let trdele = document.createElement("tr"); + trdele.setAttribute("id","(disp-"+v.id+")") + let td0 = document.createElement("td"); + let th0 = document.createTextNode(i + 1); + + let tdele = document.createElement("td"); + let tdd = document.createTextNode(v.Date); + + + let td1 = document.createElement("td"); + let th1 = document.createTextNode(v.Table); + + let td2 = document.createElement("td"); + let th2 = document.createTextNode(v.Food); + + let td3 = document.createElement("td"); + let th3 = document.createTextNode(v.Parson); + + let td4 = document.createElement("td"); + td4.setAttribute("id","bill1"); + let th4 = document.createTextNode(v.TotalBill); + + let btnelem = document.createElement("button"); + btnelem.setAttribute("onclick", "handleremove(" + v.id + ")") + let btntxt = document.createTextNode('Delete '); + + let btnedit = document.createElement("button"); + btnedit.setAttribute("onclick", "handleedit(" + v.id + ")") + let btedit = document.createTextNode("Edit"); + + + + tdele.appendChild(tdd); + td0.appendChild(th0); + trdele.appendChild(td0) + trdele.appendChild(tdele); + tableref.appendChild(trdele) + + + + td1.appendChild(th1); + trdele.appendChild(td1) + + td2.appendChild(th2); + trdele.appendChild(td2) + + td3.appendChild(th3); + trdele.appendChild(td3) + + td4.appendChild(th4); + trdele.appendChild(td4) + + btnedit.appendChild(btedit); + trdele.appendChild(btnedit); + + btnelem.appendChild(btntxt); + trdele.appendChild(btnelem); + + }); + + let ntr = document.createElement("tr"); + let nth = document.createElement("th"); + nth.setAttribute('colspan', '5'); + let ntht = document.createTextNode("Finle Counter "); + + let ntd = document.createElement("td") + ntd.setAttribute("id", "bill"); + let ntdt = document.createTextNode("Rs." + finelbill); + + nth.appendChild(ntht); + ntr.appendChild(nth); + ntd.appendChild(ntdt); + ntr.appendChild(ntd); + tableref.appendChild(ntr); + +} + +const handleedit = (id) => { + + let localdata = JSON.parse(localStorage.getItem('hoteldata')); + let index = localdata.findIndex((v)=>v.id==id) + // console.log(index); + document.getElementById("parson").value = localdata[index].Parson; + document.getElementById("food").value = localdata[index].Food; + document.getElementById("table").value = localdata[index].Table; + document.getElementById("tdate").value = localdata[index].Date; + + update= localdata[index].id; +} +const handleremove = (i) => { +let localdata = JSON.parse(localStorage.getItem('hoteldata')); + + let fdata= localdata.filter((v)=>v.id !== i) + localStorage.setItem("hoteldata", JSON.stringify(fdata)); + window.location.reload() +} +window.onload=display(); + + diff --git a/js/hotelbill.js b/js/hotelbill.js new file mode 100644 index 0000000..d7328ad --- /dev/null +++ b/js/hotelbill.js @@ -0,0 +1,181 @@ +let update = null; +const handlesubmit = () => { + let date = document.getElementById("tdate").value; + let table = document.getElementById("table").value; + let fooddp = document.getElementById("food").value; + let nopar = document.getElementById("parson").value; + let food; + let id = Math.floor(Math.random() * 100); + let localdata = JSON.parse(localStorage.getItem("hoteldata")); + if (nopar == '' || date == '') { + event.preventDefault() + document.getElementById("error").innerHTML='Please Enter Parson '; + }else if(nopar <= 0){ + event.preventDefault() + document.getElementById("error").innerHTML='Invlade Parson'; + } else { + if(update == null){ + if (fooddp === "Panjabi") { + food = "Panjabi"; + rate = 250 * nopar; + } else if (fooddp === "Chinees") { + food = "Chinees"; + rate = 150 * nopar; + } else if (fooddp === "SouthIndian") { + food = "South-Indian"; + rate = 200 * nopar; + } + let obj={ + "id": id, + "Date": date, + "Table": table, + "Food": food, + "Parson": nopar, + "TotalBill": rate, + } + + if (localdata == null) { + localStorage.setItem("hoteldata", JSON.stringify([obj])); + } else { + localdata.push(obj); + localStorage.setItem("hoteldata", JSON.stringify(localdata)); + } + console.log("Data-Added"); + }else{ + if (fooddp == "Panjabi") { + food = "Panjabi"; + rate = 250 * nopar; + } else if (fooddp == "Chinees") { + food = "Chinees"; + rate = 150 * nopar; + } else if (fooddp == "SouthIndian") { + food = "South-Indian"; + rate = 200 * nopar; + } + let obj={ + id:update, + date, + table, + food, + nopar, + rate + } + let index = localdata.findIndex((v)=>v.id == update); + localdata[index]=obj; + localStorage.setItem("hoteldata", JSON.stringify(localdata)); + + window.location.reload() + } + update=null; + } + } + +const display = () => { + let localdata = JSON.parse(localStorage.getItem("hoteldata")); + + let tableref = document.getElementById("disp"); + + let finelbill = localdata.reduce((acc, v) => acc + v.TotalBill, 0); + + + localdata.map((v, i) => { + + let trdele = document.createElement("tr"); + trdele.setAttribute("id","(disp-"+v.id+")") + let td0 = document.createElement("td"); + let th0 = document.createTextNode(i + 1); + + let tdele = document.createElement("td"); + let tdd = document.createTextNode(v.Date); + + + let td1 = document.createElement("td"); + let th1 = document.createTextNode(v.Table); + + let td2 = document.createElement("td"); + let th2 = document.createTextNode(v.Food); + + let td3 = document.createElement("td"); + let th3 = document.createTextNode(v.Parson); + + let td4 = document.createElement("td"); + td4.setAttribute("id","bill1"); + let th4 = document.createTextNode(v.TotalBill); + + let btnelem = document.createElement("button"); + btnelem.setAttribute("onclick", "handleremove(" + v.id + ")") + let btntxt = document.createTextNode('Delete '); + + let btnedit = document.createElement("button"); + btnedit.setAttribute("onclick", "handleedit(" + v.id + ")") + let btedit = document.createTextNode("Edit"); + + + + tdele.appendChild(tdd); + td0.appendChild(th0); + trdele.appendChild(td0) + trdele.appendChild(tdele); + tableref.appendChild(trdele) + + + + td1.appendChild(th1); + trdele.appendChild(td1) + + td2.appendChild(th2); + trdele.appendChild(td2) + + td3.appendChild(th3); + trdele.appendChild(td3) + + td4.appendChild(th4); + trdele.appendChild(td4) + + btnedit.appendChild(btedit); + trdele.appendChild(btnedit); + + btnelem.appendChild(btntxt); + trdele.appendChild(btnelem); + + }); + + let ntr = document.createElement("tr"); + let nth = document.createElement("th"); + nth.setAttribute('colspan', '5'); + let ntht = document.createTextNode("Total Bill"); + + let ntd = document.createElement("td") + ntd.setAttribute("id", "bill"); + let ntdt = document.createTextNode("Rs." + finelbill); + + nth.appendChild(ntht); + ntr.appendChild(nth); + ntd.appendChild(ntdt); + ntr.appendChild(ntd); + tableref.appendChild(ntr); + +} + +const handleedit = (id) => { + + let localdata = JSON.parse(localStorage.getItem('hoteldata')); + let index = localdata.findIndex((v)=>v.id==id) + // console.log(index); + document.getElementById("parson").value = localdata[index].Parson; + document.getElementById("food").value = localdata[index].Food; + document.getElementById("table").value = localdata[index].Table; + document.getElementById("tdate").value = localdata[index].Date; + + update= localdata[index].id; +} +const handleremove = (i) => { +let localdata = JSON.parse(localStorage.getItem('hoteldata')); + + let fdata= localdata.filter((v)=>v.id !== i) + localStorage.setItem("hoteldata", JSON.stringify(fdata)); + window.location.reload() +} +window.onload=display(); + + diff --git a/js/object.js b/js/object.js new file mode 100644 index 0000000..e69de29 diff --git a/js/storage.js b/js/storage.js new file mode 100644 index 0000000..a1d7ff9 --- /dev/null +++ b/js/storage.js @@ -0,0 +1,53 @@ +// localStorage.setItem('firstname','meet') +// localStorage.setItem('lastname','mistry') +// // console.log(localStorage.getItem('firstname')); +// localStorage.removeItem('lastname') + + + +// // sessionStorage.setItem('location','surat') +// // sessionStorage.removeItem('location') + +// // console.log(sessionStorage.getItem('location')); + + + +const handlSubmit = () => { + + + let localdata = JSON.parse(localStorage.getItem("name")); + + let name = document.getElementById("name").value; + + console.log(name); + + if (localdata) { + localdata.push(name); + + localStorage.setItem("name", JSON.stringify(localdata)); + } else { + + localStorage.setItem("name", JSON.stringify([name])); + } + + + // arr.push(name); + +} + +const Display = () => { + let data = JSON.parse(localStorage.getItem("name")); + let disElem = document.getElementById("disp") + disElem.innerHTML = "" + + + data.map((l) => { + let liElem = document.createElement("li"); + let liText = document.createTextNode(l) + + liElem.appendChild(liText); + disElem.appendChild(liElem); + }); +} + +Display() \ No newline at end of file diff --git a/js/todo.js b/js/todo.js new file mode 100644 index 0000000..ebe1c4f --- /dev/null +++ b/js/todo.js @@ -0,0 +1,42 @@ +let array = []; +let update = null; + +const handleremove = (i) => { + + array.splice(i , 1); + + display(); +} +const handleEdit = (i) => { + update = i; + document.getElementById("name").value = array[i]; + +} + +const display = () => { + let ulElem = document.getElementById("disp"); + + let liElem = document.createElement("li"); + let liText = document.createTextNode("100"); + + liElem.appendChild(liText); + ulElem.appendChild(liElem); + + + +} + +const handledetail = () => { + event.preventDefault(); + let name = document.getElementById("name").value; + + if (update !== null || update == 0) { + array[update] = name; + } else { + array.push(name); + } + update = null; + document.getElementById("name").value = ""; + + display(); +} \ No newline at end of file diff --git a/objects.html b/objects.html new file mode 100644 index 0000000..712e43a --- /dev/null +++ b/objects.html @@ -0,0 +1,12 @@ + + + + + + Document + + + + + + \ No newline at end of file diff --git a/storage.html b/storage.html new file mode 100644 index 0000000..9c38e22 --- /dev/null +++ b/storage.html @@ -0,0 +1,20 @@ + + + + + + Document + + +
+ + + + +
    + +
+ + + + \ No newline at end of file diff --git a/todo.html b/todo.html new file mode 100644 index 0000000..19d8f0f --- /dev/null +++ b/todo.html @@ -0,0 +1,21 @@ + + + + + + Document + + + +
+ + + + + +
    + +
+ + + \ No newline at end of file
sr nonameage