-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
121 lines (112 loc) · 4.25 KB
/
script.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
function printFunction() {
var divContents = document.getElementById("printableArea").innerHTML;
var prnt = window.open('', '', 'height=500, width=500');
prnt .document.write(divContents);
prnt .document.close();
prnt .print();
}
// function add_item(){
// let item = document.getElementById('box');
// let item2 = document.getElementById('num');
// let temp= " | "
// let list_item = document.getElementById('list_item');
function myFunction() {
let item = document.getElementById("num").value;
let item2 = document.getElementById("box").value;
if(item==0 || item2==0)
{
alert("please enter value first")
}
if (document.getElementById("sport1").checked == true) {
var table = document.getElementById("sport");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = item;
cell2.innerHTML = item2;
}
else if (document.getElementById("news1").checked == true) {
let item = document.getElementById("num").value;
let item2 = document.getElementById("box").value;
var table = document.getElementById("news");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = item;
cell2.innerHTML = item2;
}
else if (document.getElementById("movie1").checked == true) {
let item = document.getElementById("num").value;
let item2 = document.getElementById("box").value;
var table = document.getElementById("movie");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = item;
cell2.innerHTML = item2;
}
else if (document.getElementById("song1").checked == true) {
let item = document.getElementById("num").value;
let item2 = document.getElementById("box").value;
var table = document.getElementById("song");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = item;
cell2.innerHTML = item2;
}
else if (document.getElementById("favourite1").checked == true) {
let item = document.getElementById("num").value;
let item2 = document.getElementById("box").value;
var table = document.getElementById("favourite");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = item;
cell2.innerHTML = item2;
}
function printPageArea(areaID){
var printContent = document.getElementById(areaID);
var WinPrint = window.open('', '', 'width=900,height=650');
WinPrint.document.write(printContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
// var table = document.getElementById("sport");
// var row = table.insertRow(0);
// var cell1 = row.insertCell(0);
// var cell2 = row.insertCell(1);
// cell1.innerHTML = item;
// cell2.innerHTML = item2;
}
// if (item.value != NaN) {
// let make_li = document.createElement("li");
// make_li.appendChild(document.createTextNode(item.value));
// make_li.appendChild(document.createTextNode(temp));
// make_li.appendChild(document.createTextNode(item2.value));
// list_item.appendChild(make_li);
// item.value=""
// make_li.onclick = function(){
// this.parentNode.removeChild(this);
// }
// }
// else{
// alert("Please add an item");
// }
function deletenews() {
document.getElementById("news").deleteRow(1);
}
function deletesong() {
document.getElementById("song").deleteRow(1);
}
function deletemovies() {
document.getElementById("movie").deleteRow(1);
}
function deletesport() {
document.getElementById("sport").deleteRow(1);
}
function deletefavourite() {
document.getElementById("favourite").deleteRow(1);
}