Open mnewbery opened 6 months ago
Sample code for hiding divs
<!DOCTYPE html>
function toggle_div(div_name, div_id){ let collection = document.getElementsByName(div_name); for(let node in collection) { if (collection[node] !== null && node.length < 2){ if (collection[node].attributes['id'].nodeValue === div_id) { // could have said item.hidden = item.id === div_id) ? false : true; collection[node].style.display = 'block'; } else { collection[node].style.display = 'none'; } } } }
function toggle_div_byClass(div_class, div_id){ let collection = document.getElementsByClassName(div_class); for(let node in collection) { if (collection[node] !== null && node.length < 2){ if (collection[node].attributes['id'].nodeValue === div_id) { // could have said item.hidden = item.id === div_id) ? false : true; collection[node].style.display = 'block'; } else { collection[node].style.display = 'none'; } } } }
Where is the styles.css file in source control?
Extend the user web page to include these functions: