[Javascript] Re: showObject and hideObject functions ??

Peter Brunone peter at brunone.com
Wed Jun 6 11:21:31 CDT 2001


    Please reply to the list, and not directly to me; this way more people
will see your question and be able to help.

    Read the www.dansteinman.com/dynduo lessons on Hiding and Showing, and
you will learn how to hide and show things.  Dan's site is an excellent
reference, and I would rather not reproduce its entire content here.  Your
background in Java should make this material quite easy for you to
understand if you take some time to study it.

    If after following the instructions you still have questions, please
feel free to ask for help.

Regards,

Peter

----- Original Message -----
From: "yahress nataf" <yna54 at hotmail.com>
To: <peter at brunone.com>
Sent: Wednesday, June 06, 2001 3:28 PM
Subject: Re: showObject and hideObject functions ??


> Hi, it does not work, here is the file :
>
> <html>
> <head>
> <title>Untitled</title>
> <script language="JavaScript">
> ns4 = (document.layers)? true:false
>     ie4 = (document.all)? true:false
>
> function showHideText(boxName,divName) {
> if(boxName.checked = true) {
> showObject(divName);
> }
> else {
> hideObject(divName);
> }
> }
> function showObject(obj) {
> if (ns4) obj.visibility = "show"
> else if (ie4) obj.visibility = "visible"
> }
>
> function hideObject(obj) {
> if (ns4) obj.visibility = "hide"
> else if (ie4) obj.visibility = "hidden"
> }
>
> </script>
> </head>
>
> <body>
> <form>
>
> <INPUT TYPE="CHECKBOX" NAME="switchBox"
> onClick="showHideText(this,'myText')">
> <DIV ID="myText">Put text here</DIV>
> </form>
>
>
> </body>
> </html>
>
>
>
> >From: "Peter Brunone" <peter at brunone.com>
> >To: "yahress nataf" <yna54 at hotmail.com>
> >Subject: Re: showObject and hideObject functions ??
> >Date: Wed, 6 Jun 2001 09:41:04 -0500
> >
> >Look at the list of lessons; it's under the title "Showing and Hiding",
or
> >"Hiding and Showing"...
> >
> >----- Original Message -----
> >From: "yahress nataf" <yna54 at hotmail.com>
> >To: <peter at brunone.com>
> >Sent: Wednesday, June 06, 2001 12:50 PM
> >Subject: showObject and hideObject functions ??
> >
> >
> > > Hi, thank you for your help, I was always working in the server side
> >using
> > > java, but it looks like everyone has to learn javascript too, please,
I
> >went
> > > to www.dansteinman.com/dynduo , BUT could not find showObject and
> >hideObject
> > > functions.
> > >
> > >
> > > THIS IS WHAT YOU SENT TO ME :
> > >
> > >     First you'll need an onClick event handler in the checkbox, like
> >this:
> > >
> > > <INPUT TYPE="CHECKBOX" NAME="switchBox"
> > > onClick="showHideText(this,'myText')">
> > >
> > >     Next you'll need a DIV that contains the text you want to
show/hide,
> > > like this:
> > >
> > > <DIV ID="myText">Put text here</DIV>
> > >
> > > Then you'll need the JavaScript function to hide the text, like this:
> > >
> > > function showHideText(boxName,divName) {
> > >     if(boxName.checked = true) {
> > >         showObject(divName);
> > >         }
> > >     else {
> > >         hideObject(divName);
> > >         }
> > >     }
> > >
> > >     Finally you'll need your showObject and hideObject functions.  I
> >like
> >to
> > > use the ones at www.dansteinman.com/dynduo ; they're easy to implement
> >and
> > > they work well for Netscape and Explorer.





More information about the Javascript mailing list