-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
47 lines (36 loc) · 1.17 KB
/
scripts.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
// REFRESH PAGE WITH A CLICK OF A BTN
function refreshPage() {
window.location.reload();
}
/***********************************************************************************/
// DOM
let pixelsToPointsInput = document.getElementById('pixels');
let pointsToPixelsInput = document.getElementById('points');
let domResult = document.getElementById('dom-result');
// RESULT VARIABLES
let px = 'pixels';
let pt = 'points';
/***********************************************************************************/
let convertPixelsToPoints = () => {
let inputedPixels = document.getElementById('pixels').value;
pixelsInputed = inputedPixels;
result = pixelsInputed * (72 / 96);
if (result == 0) {
domResult.innerText = '';
} else {
domResult.innerText = `${result} ${pt}`;
}
};
convertPixelsToPoints();
/***********************************************************************************/
let convertPointsToPixels = () => {
let inputedPoints = document.getElementById('points').value;
pointsInputed = inputedPoints;
result = pointsInputed / (72 / 96);
if (result == 0) {
domResult.innerText = '';
} else {
domResult.innerText = `${result} ${px}.`;
}
};
convertPointsToPixels();