playing around with html css js
This commit is contained in:
parent
8955824884
commit
aaf9688d1a
1 changed files with 35 additions and 0 deletions
35
playground/html/root/cangrow.js
Normal file
35
playground/html/root/cangrow.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
function toggleDisplay(id) {
|
||||
let el = document.getElementById(id);
|
||||
let el_cs = getComputedStyle(el);
|
||||
|
||||
if (el_cs.getPropertyValue('display') === 'none') {
|
||||
el.style.display = 'inline';
|
||||
} else {
|
||||
el.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function hideAllClass(classname) {
|
||||
|
||||
const el = document.getElementsByClassName(classname);
|
||||
|
||||
for(let i = 0; i < el.length ; i++) {
|
||||
el[i].style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function showSelect(selectId, prefix, hideClass = '') {
|
||||
if(hideClass != '') {
|
||||
hideAllClass(hideClass);
|
||||
}
|
||||
|
||||
let selVal = document.getElementById(selectId).value;
|
||||
toggleId = prefix + selVal;
|
||||
if(document.getElementById(toggleId) !== null ) {
|
||||
toggleDisplay(toggleId);
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDelete(name) {
|
||||
return confirm('Delete ' + name + '?');
|
||||
}
|
Loading…
Reference in a new issue