-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
80 lines (78 loc) · 3.13 KB
/
test.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chord Function Calculator Test</title>
<script src="chordFunctions.js"></script>
</head>
<body>
<h1>Chord Function Calculator Test</h1>
<form id="chordForm">
<label for="keyCenter">Key Center:</label>
<select id="keyCenter" required>
<option value="C">C</option>
<option value="C#">C#</option>
<option value="D">D</option>
<option value="D#">D#</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="F#">F#</option>
<option value="G">G</option>
<option value="G#">G#</option>
<option value="A">A</option>
<option value="A#">A#</option>
<option value="B">B</option>
</select>
<br>
<label for="chordRoot">Chord Root:</label>
<select id="chordRoot" required>
<option value="C">C</option>
<option value="C#">C#</option>
<option value="D">D</option>
<option value="D#">D#</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="F#">F#</option>
<option value="G">G</option>
<option value="G#">G#</option>
<option value="A">A</option>
<option value="A#">A#</option>
<option value="B">B</option>
</select>
<br>
<label for="chordQuality">Chord Quality:</label>
<select id="chordQuality" required>
<option value="Major">Major</option>
<option value="Minor">Minor</option>
<option value="Augmented">Augmented</option>
<option value="Diminished">Diminished</option>
<option value="Major7">Major7</option>
<option value="Minor7">Minor7</option>
<option value="Dominant7">Dominant7</option>
<option value="HalfDiminished">Half Diminished</option>
<option value="Diminished7">Diminished7</option>
<option value="Sus4">Sus4</option>
<option value="Sus2">Sus2</option>
</select>
<br>
<button type="submit">Calculate</button>
</form>
<div id="result"></div>
<script>
document.getElementById('chordForm').addEventListener('submit', function(e) {
e.preventDefault();
const keyCenter = document.getElementById('keyCenter').value;
const chordRoot = document.getElementById('chordRoot').value;
const chordQuality = document.getElementById('chordQuality').value;
const chordName = chordRoot + chordQuality;
try {
const chordFunction = getChordFunctionFromName(chordName, keyCenter);
document.getElementById('result').textContent = `Chord Function: ${chordFunction}`;
} catch (error) {
document.getElementById('result').textContent = `Error: ${error.message}`;
}
});
</script>
</body>
</html>