Results 1 to 2 of 2

Thread: Smart Folding Menu tree issue with IE9

  1. #1
    Join Date
    Apr 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Smart Folding Menu tree issue with IE9

    1) Script Title: Smart Folding Menu Tree - old (replaced by Simple Tree Menu - new)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

    3) Describe problem:

    The smart folding menu won't work in IE9 anymore (expand/close). Probably affected by windows update (on the server) yet it still works on other browsers such as new versions of Chrome and Firefox. I just found out that this very old script has been replaced by Simple Tree menu script which is why I can't find anything related to this version and for a possible fix. If possible, I would prefer to fix the old version as it would require a lot of manual coding/re-writing to use the new version.

    Here's a shortened version of the html page.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    
    <head>
    <title></title>
    <!-- <meta content="IE=edge" http-equiv="X-UA-Compatible"> -->
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="css/Department_Resources.css" />
    <base target="content" />
    
    <!-- ============================================================================================================================================================ -->
    <!-- ========================= SCRIPT COURTESY OF http://www.dynamicdrive.com =================================================================================== -->
    <!-- ============================================================================================================================================================ -->
    
    <style>
    <!--
    #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ;
    list-style-image:url(images/fold.gif)}
    #foldinglistlink{list-style-image:url(images/link.gif)}
    #foldinglistdoc{list-style-image:url(images/pdf.gif)}
    //-->
    </style>
    <script language="JavaScript1.2">
    <!--
    
    //Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/2002)
    //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    //This credit MUST stay intact for use
    
    var head="display:''"
    img1=new Image()
    img1.src="url(images/fold.gif)"
    img2=new Image()
    img2.src="url(images/open.gif)"
    
    var ns6=(document.getElementById&&!document.all||window.opera)
    var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
    
    function checkcontained(e){
    var iscontained=0
    cur=ns6? e.target : event.srcElement
    i=0
    if (cur.id=="foldheader")
    iscontained=1
    else
    while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
    if (cur.id=="foldheader"||cur.id=="foldinglistlink"||cur.id=="foldinglistdoc") {
    iscontained=(cur.id=="foldheader")? 1 : 0
    
    break
    }
    cur=ns6? cur.parentNode : cur.parentElement
    }
    
    if (iscontained){
    var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
    if (foldercontent.style.display=="none"){
    foldercontent.style.display=""
    cur.style.listStyleImage="url(images/open.gif)"
    }
    else{
    foldercontent.style.display="none"
    cur.style.listStyleImage="url(images/fold.gif)"
    }
    }
    }
    
    if (ie4||ns6)
    document.onclick=checkcontained
    
    //-->
    </script>
    </head>
    <body>
    
    <ul>
    
    <hr/>
    <li id="foldheader" class="bodyrollupH3">Reports and Links </li>
    
    	<ul id="foldinglist" style="display:none" style=&{head};>
    	<li id="foldheader" class="bodyrollup"> Academic Programs </li>
    
    		<ul id="foldinglist" style="display:none" style=&{head};>
    		<li id="foldheader" class="bodyrollup"> Degree, Diploma, Certificate (DDCP) Programs </li>
    		</ul>
    	</ul>
    <hr/>
    
    </ul>
    
    
    </body>
    
    </html>
    Any help is appreciated. Thank you

    AR
    Last edited by arepato; 05-01-2013 at 03:26 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Updating to the newer version might not be as difficult as you think. You should be able to use your old markup. Change the id(s) and class name(s) in the simpletree.css to reflect the ones you're using. In the on page init, use your existing id(s).

    But there might be a way to fix what you're using. Try this version of the older script:

    Code:
    <!-- ============================================================================================================================================================ -->
    <!-- ========================= SCRIPT COURTESY OF http://www.dynamicdrive.com =================================================================================== -->
    <!-- ============================================================================================================================================================ -->
    
    <style type="text/css">
    
    #foldheader{cursor:pointer; font-weight:bold ;
    list-style-image:url(images/fold.gif)}
    #foldinglistlink{list-style-image:url(images/link.gif)}
    #foldinglistdoc{list-style-image:url(images/pdf.gif)}
    
    </style>
    <!--[if lt IE 6]>
    <style type="text/css">
    #foldheader{cursor: hand;}
    </style>
    <![endif]-->
    <script type="text/javascript">
    
    //Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/2002)
    //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    //This credit MUST stay intact for use
    //Updated for IE May 3rd, 2013 http://www.dynamicdrive.com/forums/showthread.php?73741&p=294192#post294192
    
    var head="display:''";
    
    ;(function(){
    	
    var img1=new Image(),
    img2=new Image();
    img1.src="images/fold.gif"
    img2.src="images/open.gif"
    var ieversion = /MSIE (\d+)/.exec(navigator.userAgent);
    ieversion = ieversion? ieversion[1] : false;
    var ns6=(document.getElementById&&!document.all||window.opera||(ieversion && ieversion > 8))
    var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
    
    function checkcontained(e){
    e = e || event;
    var iscontained=0,
    cur = e.target || event.srcElement;
    if (cur.id=="foldheader")
    iscontained=1
    else
    while (cur.parentNode){
    if (cur.id=="foldheader"||cur.id=="foldinglistlink"||cur.id=="foldinglistdoc") {
    iscontained=(cur.id=="foldheader")? 1 : 0
    
    break
    }
    cur=cur.parentNode
    }
    
    if (iscontained){
    var foldercontent=ns6&&cur.nextSibling? cur.nextSibling.nextSibling : (cur.nextSibling || cur.all.tags("UL")[0]);
    if (foldercontent && foldercontent.style.display=="none"){
    foldercontent.style.display=""
    cur.style.listStyleImage="url(images/open.gif)"
    }
    else if (foldercontent){
    foldercontent.style.display="none"
    cur.style.listStyleImage="url(images/fold.gif)"
    }
    }
    }
    
    if (document.addEventListener){
    	document.addEventListener('click', checkcontained, false);
    }
    else if (document.attachEvent){
    	document.attachEvent('onclick', checkcontained);
    }
    })();
    </script>
    I think the real problem was updating the pages from quirks mode to standards mode. This breaks the script in all modern IE, including 8. This version (above) works in IE 5.5, 6, 7, 8, 9 and 10, as well as other modern browsers, regardless of the DOCTYPE (quirks or standard mode).

    But that's just with the very limited menu from your post. There might be problems with a more extensive menu.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    Last edited by jscheuer1; 05-03-2013 at 01:35 PM. Reason: saw something
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Smart Menu Folding Tree
    By maksbud in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 01-24-2006, 04:32 AM
  2. Smart Folding Menu tree
    By cnorris in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 01-18-2006, 08:41 PM
  3. Smart Folding Tree Menu
    By Olivo Design in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 06-02-2005, 09:23 PM
  4. Smart Folding Menu tree
    By Laurey in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 05-31-2005, 06:57 AM
  5. Smart Folding Menu Tree in Tables
    By daltilio in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-18-2005, 07:49 PM

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
  •