-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindividualBreaks.js
59 lines (41 loc) · 2.19 KB
/
individualBreaks.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
function addIndivBreakField() {
var initialFrom = minValues[activeLayer];
var initialTo = maxValues[activeLayer];
if (breakCount > 0) {
initialFrom = document.getElementById("breakTo" + (breakCount)).value;
initialTo = parseInt(document.getElementById("breakTo" + (breakCount)).value);
var d = document.getElementById("td" + breakCount);
var olddiv = document.getElementById("addBtn" + breakCount);
d.removeChild(olddiv);
var rembtn = document.createElement("input");
rembtn.setAttribute("type", "image");
rembtn.setAttribute("id", "rembtn" + (breakCount));
rembtn.setAttribute("onclick", "remIndivBreakField(" + breakCount + ")");
rembtn.setAttribute("src", "images/close20.png");
d.appendChild(rembtn);
}
breakCount++;
var breaksList = document.getElementById("Breaks");
var breakEntry = document.createElement("tr");
breakEntry.setAttribute("id", "tr" + breakCount);
var breakFieldFrom = document.createElement("td");
breakFieldFrom.innerHTML = '<input type="text" class="range" style="width:50px;" id="breakFrom' + breakCount + '" value="' + initialFrom + '"></input>';
breakEntry.appendChild(breakFieldFrom);
var breakFieldTo = document.createElement("td");
breakFieldTo.innerHTML = '<input type="text" class="range" style="width:50px;" id="breakTo' + breakCount + '" value="' + initialTo + '"></input>';
breakEntry.appendChild(breakFieldTo);
var breakColor = document.createElement("td");
breakColor.innerHTML = '<input class="color" id="cp' + breakCount + '" onchange="colorChange(' + breakCount + ')" style="width:50px;">';
breakEntry.appendChild(breakColor);
var addBreak = document.createElement("td");
addBreak.setAttribute("id", "td" + breakCount);
addBreak.innerHTML = '<input type="image" src="images/plus20.png" id="addBtn' + breakCount + '" onclick="addIndivBreakField()" >';
breakEntry.appendChild(addBreak);
breaksList.appendChild(breakEntry);
jscolor.init();
}
function remIndivBreakField(count) {
var d = document.getElementById("Breaks");
var olddiv = document.getElementById("tr" + count);
d.removeChild(olddiv);
}