DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Visibility

  1. #1
    Andrea Guest

    Visibility


    Following the example made by Scott Andrew LePera, I have created two functions:
    "vis" to make the ID visible and "hid" to hidden the ID.
    But it doesn't work. Can anyone help me to fix the code? Thanks a lot in
    advance. Here you are the code I have done:

    <html>
    <head>
    <title>Discovering DHTML in Netscape 6 - Visibility Demo</title>

    <script language="JavaScript">

    function vis(menu) {
    var myElement = document.getElementById(menu);
    myElement.style.visibility = "visible";
    }

    function hid(menu) {
    var myElement = document.getElementById(menu);
    myElement.style.visibility = "hidden";
    }

    </script>

    </head>

    <body bgcolor="#669999">
    <div id="sample" style="position:absolute; left:300px; top:200px; width:200px;
    height:100px; background-color:#ff0000;
    visibility:visible; clip:rect(0px 200px 100px 0px);"></div>

    <form action="#">
    <input type="button" value="Hide DIV" onclick="hid(sample)"><br>
    <input type="button" value="Show DIV" onclick="vis(sample)"><br>
    </form>

    </body>
    </html>


  2. #2
    Michael Foster Guest

    Re: Visibility

    The argument to the vis() or hid() functions must be a string, like this:

    <input type="button" value="Hide DIV" onclick="hid('sample')"><br>

    Mike Foster : moderator : HelpFromTechs.com



    "Andrea" <alelli@quadrante.com> wrote in message
    news:3a89262f$1@news.devx.com...
    >
    > Following the example made by Scott Andrew LePera, I have created two

    functions:
    > "vis" to make the ID visible and "hid" to hidden the ID.
    > But it doesn't work. Can anyone help me to fix the code? Thanks a lot in
    > advance. Here you are the code I have done:
    >
    > <html>
    > <head>
    > <title>Discovering DHTML in Netscape 6 - Visibility Demo</title>
    >
    > <script language="JavaScript">
    >
    > function vis(menu) {
    > var myElement = document.getElementById(menu);
    > myElement.style.visibility = "visible";
    > }
    >
    > function hid(menu) {
    > var myElement = document.getElementById(menu);
    > myElement.style.visibility = "hidden";
    > }
    >
    > </script>
    >
    > </head>
    >
    > <body bgcolor="#669999">
    > <div id="sample" style="position:absolute; left:300px; top:200px;

    width:200px;
    > height:100px; background-color:#ff0000;
    > visibility:visible; clip:rect(0px 200px 100px 0px);"></div>
    >
    > <form action="#">
    > <input type="button" value="Hide DIV" onclick="hid(sample)"><br>
    > <input type="button" value="Show DIV" onclick="vis(sample)"><br>
    > </form>
    >
    > </body>
    > </html>
    >




  3. #3
    Vertigo Guest

    Re: Visibility


    document.getElementByID doesn't seem to work with Netscape Navigator 4.7

    "Michael Foster" <mfoster@cybrtyme.com> wrote:
    >The argument to the vis() or hid() functions must be a string, like this:
    >
    ><input type="button" value="Hide DIV" onclick="hid('sample')"><br>
    >
    >Mike Foster : moderator : HelpFromTechs.com
    >
    >
    >
    >"Andrea" <alelli@quadrante.com> wrote in message
    >news:3a89262f$1@news.devx.com...
    >>
    >> Following the example made by Scott Andrew LePera, I have created two

    >functions:
    >> "vis" to make the ID visible and "hid" to hidden the ID.
    >> But it doesn't work. Can anyone help me to fix the code? Thanks a lot

    in
    >> advance. Here you are the code I have done:
    >>
    >> <html>
    >> <head>
    >> <title>Discovering DHTML in Netscape 6 - Visibility Demo</title>
    >>
    >> <script language="JavaScript">
    >>
    >> function vis(menu) {
    >> var myElement = document.getElementById(menu);
    >> myElement.style.visibility = "visible";
    >> }
    >>
    >> function hid(menu) {
    >> var myElement = document.getElementById(menu);
    >> myElement.style.visibility = "hidden";
    >> }
    >>
    >> </script>
    >>
    >> </head>
    >>
    >> <body bgcolor="#669999">
    >> <div id="sample" style="position:absolute; left:300px; top:200px;

    >width:200px;
    >> height:100px; background-color:#ff0000;
    >> visibility:visible; clip:rect(0px 200px 100px 0px);"></div>
    >>
    >> <form action="#">
    >> <input type="button" value="Hide DIV" onclick="hid(sample)"><br>
    >> <input type="button" value="Show DIV" onclick="vis(sample)"><br>
    >> </form>
    >>
    >> </body>
    >> </html>
    >>

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center