Difference between revisions of "Template:HKJS S/Javascript/Notebook"

Line 1: Line 1:
 
function expandall(){
 
function expandall(){
var value = ["22/9"];
+
var value = ["22_9"];
 
var i;
 
var i;
 
for (i = 0; i < value.length; i++){
 
for (i = 0; i < value.length; i++){
Line 10: Line 10:
 
}
 
}
 
function collapseall(){
 
function collapseall(){
var value = ["22/9"];
+
var value = ["22_9"];
 
var i;
 
var i;
 
for (i = 0; i < value.length; i++){
 
for (i = 0; i < value.length; i++){

Revision as of 12:11, 23 September 2018

function expandall(){ var value = ["22_9"]; var i; for (i = 0; i < value.length; i++){ var a = value[i]; document.getElementById(a).style.display = "block"; var b = a + "_btn"; document.getElementById(b).innerHTML = "[Show]"; } } function collapseall(){ var value = ["22_9"]; var i; for (i = 0; i < value.length; i++){ var a = value[i]; document.getElementById(a).style.display = "none"; var b = a + "_btn"; document.getElementById(b).innerHTML = "[Hide]"; } } function expand(value){ var a = value + "_btn"; var btn = document.getElementById(a) if(btn.innerHTML == "[Show]"){ document.getElementById(value).style.display = "block"; document.getElementById(a).innerHTML = "[Hide]"; }else{ document.getElementById(value).style.display = "none"; document.getElementById(a).innerHTML = "[Show]"; } }