-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtechno-JS.js
70 lines (40 loc) · 1.36 KB
/
techno-JS.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
function saveData() {
const name = document.getElementById("name").value;
const email = document.getElementById("email").value;
const data = { "name": name, "email": email };
const jsonData = JSON.stringify(data);
// XMLHttpRequest-Objekt erstellen
const xhr = new XMLHttpRequest();
// Öffnen einer neuen Anfrage (HTTP-POST-Methodenaufruf) und Konfigurieren der Anforderung
xhr.open("POST", "email.json", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
console.log("Daten erfolgreich gespeichert!");
}
};
// Senden der Anforderung
xhr.send(jsonData);
}
// select anchor element
let sound = document.querySelector('.jayButton');
// let jayButton = document.querySelector('.jayButton');
// return array
let audioArr = document.getElementsByTagName('audio');
console.log(audioArr);
// add event Listener
sound.addEventListener('mouseenter', ()=>{
audioArr[0].play()
});
/*var audio = document.getElementsByTagName("audio")[0];
audio.play();
// or with an ID
var audio = document.getElementById("mySoundClip");
audio.play();
var audio = $("#mySoundClip")[0];
audio.play();*/
/*
var audio = $("#mySoundClip")[0];
$("ac-link").mouseenter(function () {
audio.play();
});*/