[Javascript] DIV visibility

Mike Dougherty mdougherty at pbp.com
Mon Oct 9 14:18:01 CDT 2006


Is this customer reporting the problem using an unusual display?

..visibility = 'hidden' does not affect the layout of what would have otherwise been in the space

So if the screen was wider than what you developed on, the non-visible content may affect the 
container space of the rest of the page.

Can you use ..display = 'none' to hide instead?  (leave the default display in the CSS, then you 
can reset using ..display='';)

On Mon, 09 Oct 2006 15:43:44 -0300
  Flávio Gomes <flavio at economisa.com.br> wrote:
> <div id="collect"> blah blah blah </div>
> <div id="result"> blah blah blah </div>
> 
> Change it all to:
> 
> function showHide(divToShow, divToHide)
> { document.getElementById(divToHide).style.visibility = 'hidden';
>  document.getElementById(divToShow).style.visibility = 'visible';
> }
> 
> 
> 
> SkyScanner escreveu:
> 
>> I haven't asked what kind of browser the guy was using yet. I am 
>> certain, though, that javascript was NOT turned off, because the error 
>> checking routine produces a confirm box:
>>  
>> var fRet = confirm('Are you sure that you have all values entered 
>> correctly?\n\nYOU ONLY GET ONE CHANCE TO DO THIS RIGHT !!');
>> if (fRet == false) {return;}
>>  
>> which he reported seeing OK, also clicking on and making it disappear.
>>  
>> The code I used to turn things on and off is rather old - its stuff I 
>> just paste in, and haven't heard of a problem with it until now:
>>  
>> /* Browser sensing */
>> /* Set up boolian variables to record the browser type */
>> var isNS4 = 0;
>> var isIE4 = 0;
>> var isNew = 0;
>> var docObj, styleObj, currObj
>>  
>> /* Determines the browser name and browser version */
>> var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));
>>  
>> /* reassign variable depending on the browser */
>> if (parseInt(navigator.appVersion >= 5)) {isNew = 1}
>>  else if (brow == "Netscape4")
>>  {isNS4 = 1;}
>>   else if (brow == "Microsoft Internet Explorer4")
>>   {isIE4 = 1;}
>>  
>> if (isNS4||isIE4||isNew) {
>>  docObj = (isNS4) ? 'document' : 'document.all';
>>  styleObj = (isNS4) ? '' : '.style';
>>  }
>>  
>> dom = eval(docObj +  '.' + 'collect' + styleObj);
>> dom.visibility = "hidden";
>> dom = eval(docObj +  '.' + 'result' + styleObj);
>> dom.visibility = "visible";
>>  
>>  
>> and then, later on in the body, I have my two DIVs:
>>  
>> <div id="collect"> blah blah blah </div>
>> <div id="result"> blah blah blah </div>
>>  
>> I hope that's enough to spot where my error is, but I would rather 
>> just replace the whole lot with something bomb-proof.
>> Perhaps what Diego suggested?
>>  
>> Tim in England
>> <off topic>yes, no longer in Ireland, I am currently volunteering at 
>> the Pestalozzi International Village for 3 months, then travelling in 
>> Africa for the next 8 months - see my blog site 
>> www.mapability.com/travel <http://www.mapability.com/travel> I am just 
>> trying to get everything on my site 'fully automatic' before I leave - 
>> hahaha is that hoping too much?! </off topic>
>>  
>>
>>     ----- Original Message -----
>>     *From:* Peter Brunone <mailto:peter at brunone.com>
>>     *To:* javascript at LaTech.edu <mailto:javascript at LaTech.edu>
>>     *Sent:* Monday, October 09, 2006 7:01 PM
>>     *Subject:* re: [Javascript] DIV visibility
>>
>>     Hi Tim (not top 'o the mornin' anymore?)...
>>
>>        That should work.  Can you show us the actual code, and perhaps
>>     share with us what kind of browser/os/etc this user is using? 
>>     Does he have Javascript enabled?  Is there an error message, what
>>     is it, etc?
>>
>>     Cheers,
>>
>>     Peter
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>  
>>
> 
> -- 
>Flavio Gomes
> flavio at economisa.com.br
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list