Änderungen
Aus Hackerspace Ffm
Die Seite wurde neu angelegt: „<pre> <!DOCTYPE html> <html> <body> <button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button> <p id="demo"></p> <p>A function i…“
<pre>
<!DOCTYPE html>
<html>
<body>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button>
<p id="demo"></p>
<p>A function is triggered when the button is clicked. The function outputs some text in a p element with id="demo".</p>
<script>
function myFunctionOff() {
document.getElementById("demo").innerHTML = "Hello World";
gainObj.gain.value = 0;
}
function myFunctionOn(f) {
document.getElementById("demo").innerHTML = "Hello World2";
osc.frequency.value = f;
gainObj.gain.value = 1;
}
context = new AudioContext;
osc = context.createOscillator();
osc.type=osc.SQUARE;
osc.frequency.value = 440;
osc.start(0);
var gainObj = context.createGain();
gainObj.gain.value = 0;
osc.connect(gainObj);
gainObj.connect(context.destination);
</script>
</body>
</html>
</pre>
<!DOCTYPE html>
<html>
<body>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button>
<p id="demo"></p>
<p>A function is triggered when the button is clicked. The function outputs some text in a p element with id="demo".</p>
<script>
function myFunctionOff() {
document.getElementById("demo").innerHTML = "Hello World";
gainObj.gain.value = 0;
}
function myFunctionOn(f) {
document.getElementById("demo").innerHTML = "Hello World2";
osc.frequency.value = f;
gainObj.gain.value = 1;
}
context = new AudioContext;
osc = context.createOscillator();
osc.type=osc.SQUARE;
osc.frequency.value = 440;
osc.start(0);
var gainObj = context.createGain();
gainObj.gain.value = 0;
osc.connect(gainObj);
gainObj.connect(context.destination);
</script>
</body>
</html>
</pre>