window.addEventListener('load', () => { // noinspection JSUnresolvedVariable let audioCtx = new (window.AudioContext || window.webkitAudioContext)(); let xhr = new XMLHttpRequest(); xhr.open('GET', 'audio-autoplay.wav'); xhr.responseType = 'arraybuffer'; xhr.addEventListener('load', () => { let playsound = (audioBuffer) => { let source = audioCtx.createBufferSource(); source.buffer = audioBuffer; source.connect(audioCtx.destination); source.loop = false; source.start(); setTimeout(function () { let t = document.createElement('p'); t.appendChild(document.createTextNode((new Date()).toLocaleString() + ': Sound played')); document.querySelector('.output').appendChild(t); playsound(audioBuffer); }, 1000 + Math.random()*2500); }; audioCtx.decodeAudioData(xhr.response).then(playsound); }); xhr.send(); });
To collect a group of elements, we pass the selector to the jQuery function using…
jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is…
HTML:- [crayon-68bdf3be3402f939822982/] CSS:- [crayon-68bdf3be34036600500688/] JavaScript:- [crayon-68bdf3be34038567463254/]
Prevent users typing special characters in text box, textarea, etc. [crayon-68bdf3be341e2934743243/] ^[a-zA-Z]+$ Alphabets ^[a-zA-Z\s]+$ Alphabets…
Any interactive web site has form input - a place where the users input different…
[crayon-68bdf3be3456c198232284/]