SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE vx. FF vs. Safari simple div hide / reveal

    Hi folks. First post here. I did a search on this as well as perusing the tips threads etc but I did not see this addressed. I suspect it has been but I am just too old and blind to see it. So I apologize in advance if this has been asked and answered.

    The following code runs fine in FF but not in Safari or IE. Looking for tips on adjusting it:

    Code HTML4Strict:
    <html>
    <head>
    <title>Expander test</title>
     
    <script type="text/javascript">
    <!--
     
    function toggleMenu(currMenu,prevMenu)
    {
    	if(document.all(currMenu).style == 'display: block')
    	{
    		document.all(currMenu).style = 'display: none';
    		document.all(prevMenu).style = 'display: block';
    	}
     
    	else
     
    	{
     
    		document.all(prevMenu).style = 'display: none';
    		document.all(currMenu).style = 'display: block';
    	}
     
    	return false;
    }
     
    -->
     
    </script>
     
    </head>
     
    <body>
     
    <div style="display: block;" id="collapsed-ur1" >
     
            <div >
                <a style="cursor: default;" onMouseOver="this.style.cursor='pointer'" onMouseOut="this.style.cursor='default'" 
                onclick="return toggleMenu('expanded-ur1', 'collapsed-ur1')">Expand Section [+]
                </a>
            </div>
    </div>
     
    <div style="display: none;" id="expanded-ur1" >
     
    	<div >
    		<a style="cursor: default;" onMouseOver="this.style.cursor='pointer'" onMouseOut="this.style.cursor='default'" 
             onclick="return toggleMenu('collapsed-ur1', 'expanded-ur1')">Collapse Section [-]
            </a>
    	</div>
     
    	<BR />
        <table width="400" border="0">
    	  <tr>
        	<td>PDF has become the standard format for electronically sharing documents. But what can you do with your PDFs once they're created 
            	Acrobat 7 Essential Training shows you how to take your PDFs to the next level by adding interactive elements such as links, 
                bookmarks, and form fields. You'll learn to tweak your PDFs using Acrobat Distiller, make changes to them using Acrobat's editing 
                tools, and keep them safe using the new security features. Covering both the Standard and Professional versions of Acrobat 7, these 
                movies ensure that you'll master the key features of this diverse application in no time.
    	    </td>
    	  </tr>
    	</table>
     
    </div>
     
    </body>
    </html>

    Thank you all in advance for your answer and your patience

  2. #2
    SitePoint Enthusiast PicklePete's Avatar
    Join Date
    Apr 2008
    Location
    England
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    PHP Code:
    function toggleMenu(currMenuprevMenu) {
        if(
    document.getElementById(currMenu).style.display == 'block') {
            
    document.getElementById(currMenu).style.display 'none';
            
    document.getElementById(prevMenu).style.display 'block';
        }
        else {
            
    document.getElementById(currMenu).style.display 'block';
            
    document.getElementById(prevMenu).style.display 'none';    
        }


  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent!

    Thank you all SO much!


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
  •