[Javascript] DIV visibility

SkyScanner skyscanner at eircom.net
Mon Oct 9 13:24:21 CDT 2006


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 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 
  To: 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20061009/7830dc83/attachment.htm>


More information about the Javascript mailing list