Quellcode durchsuchen

Adding updateSelect function taking the input element, list of cells with buttons, the value of the input and the label of the button as inputs and outcome is the changed value of the input and color applied to selected buttons

Andrej Studen vor 1 Jahr
Ursprung
Commit
77d15c6f6c
1 geänderte Dateien mit 25 neuen und 1 gelöschten Zeilen
  1. 25 1
      web/crf/crfHTML.js

+ 25 - 1
web/crf/crfHTML.js

@@ -27,7 +27,13 @@ crfHTML.addStyle=
 function(el,style){
 function(el,style){
    el.classList.add(style);
    el.classList.add(style);
 }
 }
- 
+
+
+crfHTML.clearStyle=
+function(el,style){
+   el.classList.remove(style);
+}
+
 crfHTML.createSelect=
 crfHTML.createSelect=
 function(qMap,id=null,el=null){
 function(qMap,id=null,el=null){
    let fName='[makeSelect]';
    let fName='[makeSelect]';
@@ -180,4 +186,22 @@ function(input,qMap){
 	input.selectedIndex=0;	
 	input.selectedIndex=0;	
 }
 }
 
 
+crfHTML.updateSelect=
+function(input,cell,x,value){
+   let fName='[updateSelect]';
+   this.print(fName+' value '+value);
+   let children=cell.children;
+   for (let i=0;i<children.length;i++){
+      let el=children[i];
+      let lab=el.value;
+      this.print(fName+' style ['+el.className+']');
+      this.clearStyle(el,'teal');
+      if (lab==value){
+         lab+='[*]';
+         this.addStyle(el,'teal');
+      }
+      this.print(fName+' '+lab);
 
 
+   }
+   input.value=x;
+}