[Javascript] DIV visibility

Peter Brunone peter at brunone.com
Mon Oct 9 14:33:08 CDT 2006


		   Although if he's really concerned about Netscape 4, he'll have to check for that and use document.layers instead...

Peter

				From: Flávio Gomes flavio at economisa.com.br

		blah blah blah 

		blah blah blah 

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:
> 
> 
blah blah blah 
> 
blah blah blah 
> 
> 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
> 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 I am just 
> trying to get everything on my site 'fully automatic' before I leave - 
> hahaha is that hoping too much?! BR>> 
>
> ----- Original Message -----
> *From:* Peter Brunone 
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20061009/fd276151/attachment.htm>


More information about the Javascript mailing list