haku87 Posted March 20, 2007 Share Posted March 20, 2007 I had this problem with Internet Explorer 6 where the minus and plus icon is not display.. It was ok when opened with FireFox.. Could anyone helps? <style type="text/css"><!-- #containerul, #containerul ul{ margin:0; /* Removes browser default margins applied to the lists. */ padding:0; /* Removes browser default padding applied to the lists. */ } #containerul li{ margin:0 0 0 10px; padding:0; list-style-type:none; } #containerul .symbols{ float:left; width:12px; height:1em; background-position:center 50%; background-repeat:no-repeat; left: 135px; position: relative; } #containerul .symbols2{ float:left; width:12px; height:1em; background-position:center 50%; background-repeat:no-repeat; right: 5px; position: relative; } .submenu { background-color: white; width: 150; margin:0px; padding: 0px; display: block; border-top: 0px solid #999; border-right: 1px solid #999; border-bottom: 1px solid #999; border-left: 1px solid #999; text-align: left; } .mhead { background-image: url(./images/tableheading.gif); border: 1px solid #999; width: 150; margin: 0px; padding: 0px; display: block; font-size: small; font-family: "Arial", "Helvetica", "sans-serif"; font-weight: normal; font-style: normal; text-align: left; } --></style> <script type="text/javascript"> //<!-- var temp, temp2, cookieArray, cookieArray2, cookieCount; function initiate(){ cookieCount=0; if(document.cookie){ cookieArray=document.cookie.split(";"); cookieArray2=new Array(); for(i in cookieArray){ cookieArray2[cookieArray[i].split("=")[0].replace(/ /g,"")]=cookieArray[i].split("=")[1].replace(/ /g,""); } } cookieArray=(document.cookie.indexOf("state=")>=0)?cookieArray2["state"].split(","):new Array(); temp=document.getElementById("containerul"); for(var o=0;o<temp.getElementsByTagName("li").length;o++){ if(temp.getElementsByTagName("li")[o].getElementsByTagName("ul").length>0){ temp2 = document.createElement("span"); temp2.className = "symbols"; temp2.style.backgroundImage = (cookieArray.length>0)?((cookieArray[cookieCount]=="true")?"url(./images/plus.png)":"url(./images/minus.png)"):"url(./images/minus.png)"; temp2.onclick=function(){ showhide(this.parentNode); writeCookie(); } temp.getElementsByTagName("li")[o].insertBefore(temp2,temp.getElementsByTagName("li")[o].firstChild) temp.getElementsByTagName("li")[o].getElementsByTagName("ul")[0].style.display = "block"; if(cookieArray[cookieCount]=="true"){ showhide(temp.getElementsByTagName("li")[o]); } cookieCount++; } else{ temp2 = document.createElement("span"); temp2.className = "symbols2"; temp2.style.backgroundImage = "url(graphic.png)"; temp.getElementsByTagName("li")[o].insertBefore(temp2,temp.getElementsByTagName("li")[o].firstChild); } } } function showhide(el){ el.getElementsByTagName("ul")[0].style.display=(el.getElementsByTagName("ul")[0].style.display=="block")?"none":"block"; el.getElementsByTagName("span")[0].style.backgroundImage=(el.getElementsByTagName("ul")[0].style.display=="none")?"url(./images/plus.png)":"url(./images/minus.png)"; } function writeCookie(){ // Runs through the menu and puts the "states" of each nested list into an array, the array is then joined together and assigned to a cookie. cookieArray=new Array() for(var q=0;q<temp.getElementsByTagName("li").length;q++){ if(temp.getElementsByTagName("li")[q].childNodes.length>0){ if(temp.getElementsByTagName("li")[q].childNodes[0].nodeName=="SPAN" && temp.getElementsByTagName("li")[q].getElementsByTagName("ul").length>0){ cookieArray[cookieArray.length]=(temp.getElementsByTagName("li")[q].getElementsByTagName("ul")[0].style.display=="none"); } } } document.cookie="state="+cookieArray.join(",")+";expires="+new Date(new Date().getTime() + 365*24*60*60*1000).toGMTString(); } //--> </script> <?php function generateMenu($header, $items, $left_pos, $top_pos) { $string = '<style type="text/css"><!-- .'.$header. '{ position: relative; left: '.$left_pos.'px; top:'.$top_pos.'px; } --></style>'; $string .= '<div class="'.$header.'">'; $string .= ' <li> <div class="mhead">'.$header.'</div> <ul> <div class="submenu">'; foreach ($items as $name => $link) { $string .= '<li> <a href="'.$link.'"><font color="black">'.$name.'</font></a> </li>'; } $string .= '</ul> </div> </li> '; $string .= '</div>'; return $string; }?> <?php function generateAllMenus($menus) { echo '<ul id="containerul">'; foreach($menus as $menu) echo $menu; echo '</ul>'; echo '<script type="text/javascript"> initiate(); // This must be placed immediately after the menu in order to format it properly. </script>'; }?> Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted March 20, 2007 Share Posted March 20, 2007 A link to see it in context would help. It is always easiest to debug the browser side generated html to determine that the for loops and strings are in proper order when the php echos and that the css is correctly written. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.