mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
36 lines
993 B
JavaScript
36 lines
993 B
JavaScript
//
|
|
// Function to toggle the display of a block element in a page.
|
|
//
|
|
// There is a CSS-only mechanism to do this, but it does not work properly
|
|
// on Opera and apparently Safari.
|
|
//
|
|
function showBlock(el) {
|
|
var objEl = document.getElementById(el);
|
|
|
|
// Find out the value of the CSS variable "display".
|
|
// Need to use this round-about method since global styles are not
|
|
// recognised when looking at an object's style class
|
|
// (i.e. objEl.style).
|
|
if (objEl.currentStyle) // IE 5
|
|
var displayProp = objEl.currentStyle["display"];
|
|
else if (window.getComputedStyle) { // MOZILLA
|
|
var tstyle = window.getComputedStyle(objEl, "");
|
|
var displayProp = tstyle.getPropertyValue("display");
|
|
}
|
|
|
|
// Toggle the display property.
|
|
if(displayProp=="block") {
|
|
objEl.style.display="none";
|
|
}
|
|
else {
|
|
objEl.style.display="block";
|
|
}
|
|
}
|
|
|
|
|
|
function hideBlock(el) {
|
|
var objEl = document.getElementById(el);
|
|
|
|
objEl.style.display="none";
|
|
}
|