SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Midwest
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    style="display=none" issue

    The below code works just fine in IE, but with Netscape, when the page initially loads, the div that is set to display="none" still displays. If I use the JavaScript, it does hide the div. So why does it not hide the div when the page first loads? I think I am setting the same attribute.

    Thanks in advance for the help.

    Code:
    <html>
    
    <head>
    
    <script language="JavaScript">
    
    function flip()
    {        
       //alert("Test");
    
       if ( document.getElementById("photoDisplay").style.display == "none" )
       {
          document.getElementById("photoList").style.display = "none";
          document.getElementById("photoDisplay").style.display = "inline";
       }
       else
       {
          document.getElementById("photoList").style.display = "inline";
          document.getElementById("photoDisplay").style.display = "none";
       }
    }
    
    function Prev()
    {
       alert("Prev");
    }
    
    function Next()
    {
       alert("Next");
    }
    
    function displayPhoto(num)
    {
    
    }
    
    </script>
    
    </head>
    
    <body>
    
    <form name="photoAlbumForm">
    
    <a href="javascript: flip()">Switch</a>
    
    <p>
    
    <div id="photoList">
       <a href="javascript: displayPhoto('0')">Photo 1</a>
       &nbsp;
       <a href="javascript: displayPhoto('1')">Photo 2</a>
       &nbsp;
       <a href="javascript: displayPhoto('2')">Photo 3</a>
    </div>
    
    <p>
    
    <div id="photoDisplay" style="display=none">
       <a href="javascript: Prev()">Prev</a> 
       &nbsp;
       <a href="javascript: Next()">Next</a>
    </div>
    
    </form>
    
    </body>
    </html>

  2. #2
    SitePoint Enthusiast ada80ro's Avatar
    Join Date
    Apr 2005
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this is the problem:
    <div id="photoDisplay" style="display=none">

    it should be
    <div id="photoDisplay" style="display:none">

  3. #3
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Midwest
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That was it. Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •