-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
89 lines (78 loc) · 2.5 KB
/
app.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
const links = document.querySelectorAll(".link");
const sections = document.querySelectorAll("section");
let activeLink = 0;
links.forEach((link, i) => {
debugger;
link.addEventListener("click", () => {
if (activeLink != i) {
links[activeLink].classList.remove("active");
link.classList.add("active");
sections[activeLink].classList.remove("active");
setTimeout(() => {
activeLink = i;
sections[i].classList.add("active");
}, 100);
}
});
});
function DownloadFile(fileName) {
//Set the File URL.
var url = "Files/" + fileName;
//Create XMLHTTP Request.
var req = new XMLHttpRequest();
req.open("GET", url, true);
req.responseType = "blob";
req.onload = function () {
//Convert the Byte Data to BLOB object.
var blob = new Blob([req.response], { type: "application/octetstream" });
//Check the Browser type and download the File.
var isIE = false || !!document.documentMode;
if (isIE) {
window.navigator.msSaveBlob(blob, fileName);
} else {
var url = window.URL || window.webkitURL;
link = url.createObjectURL(blob);
var a = document.createElement("a");
a.setAttribute("download", fileName);
a.setAttribute("href", link);
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
};
req.send();
}
debugger;
function play() {
var audio = document.getElementById("audio");
audio.play();
audio.volume = 0.1;
}
//form submit
// const name_form=document.getElementById('name');
// const email=document.getElementById('email');
// const message=document.getElementById('message');
// name_form.addEventListener('blur', valName);
// email.addEventListener('blur', valEmail);
// phone.addEventListener('blur', valPhone);
// function valName() {
// const re = /^[a-zA-Z]{2,20}$/;
// if(!re.test(name_form.value)) {
// name_form.classList.add('is-invalid');
// } else {
// name_form.classList.remove('is-invalid');
// }
// }
// debugger;
// document.querySelector("myform").addEventListener("btnSubmit", handleSubmit);
// const handleSubmit = (e) => {
// e.preventDefault()
// let myForm = document.getElementById('myform');
// let formData = new FormData(myForm)
// fetch('/', {
// method: 'POST',
// headers: { "Content-Type": "application/x-www-form-urlencoded" },
// body: new URLSearchParams(formData).toString()
// }).then(() => console.log('Form successfully submitted')).catch((error) =>
// alert(error))
//