Forum Moderators: open
1. 1st click: The display property is an emty string .
- test fails, and property set (locally this time) to 'none'.
2. 2nd click: Now we're in business.
Here's a solution:
function togDisplay(id)
{
var style = document.getElementById(id).style;
style.display =!style.display? 'block' : '';
}
This assumes that
a) The default style in the stylesheet is 'none';
b) Any elements that are shown from the start have 'display:block;' in their own inline style attribute (but will default to the stylesheet's 'none' whenever this is removed).