Jump to content

Trying to create a Son of Suckerfish dropdown menu.


AdrianRobinson

Recommended Posts

I'm attempting to create a dropdown hover menu by following the instructions on the Suckerfish site. The list that is supposed to dropdown simply stays visible all the time. Is there anything in the code that seems to be the apparent cause of the problem? You will be able to tell that I'm new to PHP. Any suggestions would be appreciated.

 

The following is my CSS and PHP code:

 

CSS:

 

#nav, #nav ul{
padding: 0;
margin: 0;
list-style: none;
}

#nav a{
display: block;
width: 10em;
}

#nav li{
float: left;
width: 10em;
}	

#nav li ul{
position: absolute;
width: 10em;
left: -999em;
}

#nav li: hover ul{
left: auto;
}	

#nav li:hover ul, #nav li.sfhover ul{
left: auto;
}

 

PHP/JavaScript:

 

 

 

function draw_app_menu() {
    // draw the application menu
?>
    <!-- left - background-color: #cdeb8b - lime -->
[color=blue]<script type="text/javascript">
shHover = function() {
  var sfEls = document.getElementByID("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length;i++) {
      sfEls[i].onmouseover=function() {
        this.className+=" sfhover";
      }
      sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
      }
    }
  }
  
  if (window.attachEvent) window.attachEvent("onload",sfhover);

</script>[/color]
    
    
[color=green]<ul id = "nav">[/color]    

<?php
    
    session_start();
    if (isset($_SESSION['selected_app']))
    {
      // echo '<p> selected_app was set </p>';  
      foreach ($_SESSION['application_list'] as $app_list)
      {
         if (($app_list[5] == 'A') && ($app_list[0] == $_SESSION['selected_app']))
         {
           $_SESSION['current_link'] = $app_list[2];
         }   
         if (($app_list[0] == $_SESSION['selected_app']) && (($app_list[5] == 'M') || ($app_list[5] == 'S')))
         {
           if ($app_list[5] == 'M')
           { 
             ?>
             [color=green]<li><a href="<?php echo $_SESSION['current_link'].'?id='.$_SESSION['selected_app'].'&modid='.$app_list[3].'&func='.$app_list[6];?>"><?php echo $app_list[1];?></a></li>[/color]              
<?php
            $_SESSION['selected_mod'] = $_GET['modid'];
            $_SESSION['app_function'] = $_GET['func'];
            }
           ?>
          [color=green] <ul>[/color]          
<?php
           if ($app_list[5] == 'S')
           {
                ?>
              [color=green]<li><a href="<?php echo $_SESSION['current_link'].'?id='.$_SESSION['selected_app'].'&modid='.$app_list[3].'&submodid='.$app_list[4].'&func='.$app_list[6];?>"><?php echo $app_list[1];?></a></li>[/color]              <?php
            $_SESSION['selected_mod'] = $_GET['modid'];
            $_SESSION['selected_submod'] = $_GET['submodid'];
            $_SESSION['app_function'] = $_GET['func'];
            }
            ?>
            [color=green]</ul>
            </li>[/color]            
<?php
         } 
      }
    }
    ?>
    [color=green]</ul>[/color]    <script src="sfhover.js" type="text/javascript"></script>
    <?php
    
}


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.