Epics@GSI Webhome

Toggle Visibility



This JavaScript-function enables you to toggle the visibility of almost any object of HTML code, having an object id defined, changing from invisible to a display style mode, vice versa.
In this example toggled by a click. It is also possible to use any Event mechanissm like onClick, onMouseOver etc.


Click for change of visibility



<div onClick="toggleVisibility('source','block');"> __Click for change of visibility__ </div>
<div id="source" style="display: none; padding: 20px; background-color:red">
originally found at and extended <br />


toggleVisibility('object id','display style of visible object');
<!-- display style, e.g. 'block', 'inline', 'inline-block', 'list-item', 'run-in' and more -->

-- PeterZumbruch - 02 Jul 2007
Topic revision: r4 - 2007-09-14, PeterZumbruch - This page was cached on 2022-05-20 - 19:48.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)