Commit f2338a4b authored by Dominik Schuhmann's avatar Dominik Schuhmann
Browse files

more Units as ID with ';' as Seperator possible

parent b4aae08e
......@@ -23,30 +23,36 @@
</head>
<body>
<h1 style = "text-align: center">Checkbox 1</h1>
<!--einzellne Units-->
<h3 style = "text-align: center">Checkbox 1</h3>
<div style="text-align: center">
<input type="checkbox" id="stack" class="checkboxunit" name="horns" onclick="myfunction()">
</div>
<h1 style = "text-align: center">Checkbox 2</h1>
<h3 style = "text-align: center">Checkbox 2</h3>
<div style="text-align: center">
<input type="checkbox" id="unit" class="checkboxunit" name="horns" style onclick="myfunction()">
</div>
<h1 style = "text-align: center">Checkbox 3</h1>
<h3 style = "text-align: center">Checkbox 3</h3>
<div style="text-align: center">
<input type="checkbox" id="rgbUnit" class="checkboxunit" name="horns" style onclick="myfunction()">
</div>
<h1 style = "text-align: center">Checkbox 4</h1>
<h3 style = "text-align: center">Checkbox 4</h3>
<div style="text-align: center">
<input type="checkbox" id="hub" class="checkboxunit" name="horns" style onclick="myfunction()">
</div>
<h1 style = "text-align: center">Checkbox 5</h1>
<h3 style = "text-align: center">Checkbox 5</h3>
<div style="text-align: center">
<input type="checkbox" id="dual-B" class="checkboxunit" name="horns" style onclick="myfunction()">
</div>
<h1 style = "text-align: center">Checkbox 6</h1>
<h3 style = "text-align: center">Checkbox 6</h3>
<div style="text-align: center">
<input type="checkbox" id="pir" class="checkboxunit" name="horns" style onclick="myfunction()">
</div>
<!--mehrere Units müssen mit einem Semikolon unterteilt werden-->
<h3 style = "text-align: center">Checkbox 7 pir and rgb</h3>
<div style="text-align: center">
<input type="checkbox" id="pir;rgbUnit" class="checkboxunit" name="horns" style onclick="myfunction()">
</div>
<!--<div>
<h1>Resultar.</h1>
<p id="result"></p>
......@@ -60,7 +66,8 @@
<h3 id="infoseiten"></h3>
</div>
<script src="C:\Users\Dominik\Documents\PhpStorm_Workspace\Nerdtree\js\main.js"></script>
<!--muss immer an den jeweiligen Pfad der main.js datei angepasst werden.-->
<script src="C:\Users\Dominik\Documents\Jku\M5Stack\PHPStorm\Nerdtree\js\main.js"></script>
</body>
</html>
function myfunction() {
//deklaration aller checkboxen, mit dem namen der Unit als ID und eine checked function
var check1 = document.getElementById('stack');
var check2 = document.getElementById('unit');
var check3 = document.getElementById('rgbUnit');
var check4 = document.getElementById('hub');
var check5 = document.getElementById('dual-B');
var check6 = document.getElementById('pir');
var check7 = document.getElementById('pir;rgbUnit')
var array = [];
if (check1.checked == true) {
array.push(check1.id);
......@@ -24,10 +26,19 @@ function myfunction() {
if (check6.checked == true) {
array.push(check6.id);
}
if (check7.checked == true) {
array.push(split(check7.id));
}
getmoeglicheAufgaben(array);
}
//function to split more Units IDs
function split(string){
return string.split(';');
}
function getmoeglicheAufgaben(array){
//deklaration Aufgaben
if(array!=null) array = array.flat();
console.log(array);
//deklaration Aufgaben
var aufledsleucht = [["rgbUnit"],"http://nerd40.ce.jku.at/?page_id=493", "LEDs zum Leuchten bringen"];
var leuchtenpir = [["pir"],"http://nerd40.ce.jku.at/?page_id=594", "Licht leuchten lassen mit Bewegungssensor"];
var ledsbewegungssensor =[["rgbUnit","pir"], "http://nerd40.ce.jku.at/?page_id=940", "LEDs leuchten lassen mithilfe eines Bewegungssensors"];
......@@ -105,5 +116,4 @@ function getmoeglicheAufgaben(array){
function printInfo (x){
textinfos += "<li>"+"<a href="+x[1] +">"+x[2]+"</a>"+"<p>Verwendete Units: "+x[0]+"</p>"+"</li>";
}
//afsdafh
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment