Re: Folding closed space for a hidden form
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Folding closed space for a hidden form

From: ASM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date: Fri Aug 12 2005 - 10:22:15 CEST

RobG wrote:
> ASM wrote:
>
>> Mick White wrote:
>>
>>> ASM wrote:
>>>
>>>> function showform(mydiv) {
>>>> var d = document.getElementById(mydiv).style;
>>>> d.display = (d.display=='visible')? 'hidden' : 'visible';
>>>> }
>>>>
>>> d.display=d.display=='none'?'':'none';
>>>
>>> Mick
>>
>> Oooppss ! :-(
>>
>> but (as I think default is 'none')
>>
>> d.display=d.display=='none'?'block':'none';
>>
>
> If you toggle between '' and 'none' (as suggested by Mick) it will work
> for any element, block or otherwise.

Usually : yes

However, What I wanted to say was
the div(s) to show/hide is(are) 1st styled with { display: none }
so, I think the correct code would have to be :

    d.display=d.display=='none'?'block':'none';

Of course, to be compatible with eventual disabled JS
it would be better :
- to use a function to hide the shown div(s)
- then to use Mick's code

-- 
Stephane Moriaux et son [moins] vieux Mac
Received on Tue Oct 18 03:08:02 2005