Results 1 to 2 of 2

Thread: AnyLink Menu Won't "Drop Down"

  1. #1
    Join Date
    Sep 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question AnyLink Menu Won't "Drop Down"

    1) Script Title: AnyLink Drop Down Menu

    2) Script URL (on DD): Click Here

    3) Describe problem: After a certain period of time the menus just won't drop down anymore. Refer to bottom of my post for link and demo. IE give me these two following script errors:

    Line:114
    Char:1
    Code:0
    Error:'dropmenuobj' is null or not an object
    URL:http://quickscriptz.ca/djpanel4/usercp.php?show=home

    Line:157
    Char:1
    Code:0
    Error:Object required
    URL:http://quickscriptz.ca/djpanel4/usercp.php?show=home
    I've modified the js code slightly so I'm not sure if I've made something go weird or what exactly has happened... I've integrated some php so that might be part of the problem, anyways heres the code:

    PHP Code:
    <script type="text/javascript">
    <?php
    require('connect.php');
    $result mysql_query("SELECT language FROM rp4_settings");
    $row mysql_fetch_array($result);
    $templang $row['language'];
    $langfile "languages/$templang.php";
    require(
    $langfile);
    function 
    num($input$link){
        echo 
    '<a href="'.$link.'"><img src="images/arrow.gif" border="0" /> ';
        echo 
    $input;
        echo 
    '</a>';
    }
    ?>
    /***********************************************
    * Based on Dynamic Drive's AnyLink Vertical Menu
    * Original Version - © Dynamic Drive
    * Modified Version - © QuickScriptz Design
    ***********************************************/

    var menu1=new Array() //Radio
    menu1[0]='<?php num($menu10'radio.php?do=news');?>
    menu1[1]='<?php num($menu11'radio.php?do=rules');?>
    menu1[2]='<?php num($menu12'radio.php?do=stafflist');?>
    menu1[3]='<?php num($menu13'radio.php?do=emaillist');?>
    menu1[4]='<?php num($menu14'radio.php?do=serverd');?>

    var menu2=new Array() //Chat
    menu2[0]='<?php num($menu20'chat.php?do=staffchat');?>
    menu2[1]='<?php num($menu21'chat.php?do=alertsite');?>
    menu2[2]='<?php num($menu22'chat.php?do=alertvisitor');?>
    menu2[3]='<?php num($menu23'chat.php?do=alertdj');?>

    var menu3=new Array() //DJ Tools
    menu3[0]='<?php num($menu30'?show=djtools&do=');?>
    menu3[1]='<?php num($menu31'?show=djtools&do=');?>
    menu3[2]='<?php num($menu32'?show=djtools&do=');?>
    menu3[3]='<?php num($menu33'?show=djtools&do=');?>
    menu3[4]='<?php num($menu34'?show=djtools&do=');?>

    var menu4=new Array() //Messaging
    menu4[0]='<?php num($menu40'?show=messaging&do=');?>
    menu4[1]='<?php num($menu41'?show=messaging&do=');?>
    menu4[2]='<?php num($menu42'?show=messaging&do=');?>
    menu4[3]='<?php num($menu43'?show=messaging&do=');?>
    menu4[4]='<?php num($menu44'?show=messaging&do=');?>

    var menu5=new Array() //Extras
    menu5[0]='<?php num($menu50'?show=extras&do=');?>
    menu5[1]='<?php num($menu51'?show=extras&do=');?>

    var menu6=new Array() //Contact
    menu6[0]='<?php num($menu60'?show=contact&do=');?>
    menu6[1]='<?php num($menu61'?show=contact&do=');?>
    menu6[2]='<?php num($menu62'?show=contact&do=');?>
    menu6[3]='<?php num($menu63'?show=contact&do=');?>
            
    var menuwidth='16.6%' 
    var menubgcolor='#CDCDCD;filter:alpha(opacity=95);-moz-opacity:.95;opacity:.95' 
    var disappeardelay=250 
    var hidemenu_onclick="yes" 

    var ie4=document.all
    var ns6=document.getElementById&&!document.all

    if (ie4||ns6)
    document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

    function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="right")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }

    function showhide(obj, e, visible, hidden, menuwidth){
    if (ie4||ns6)
    dropmenuobj.style.left=dropmenuobj.style.top="-500px"
    if (menuwidth!=""){
    dropmenuobj.widthobj=dropmenuobj.style
    dropmenuobj.widthobj.width=menuwidth
    }
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
    obj.visibility=visible
    else if (e.type=="click")
    obj.visibility=hidden
    }

    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    function clearbrowseredge(obj, whichedge){
    var edgeoffset=0
    if (whichedge=="leftedge"){
    var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
    dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
    }
    else{
    var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
    var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
    dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
    }
    }
    return edgeoffset
    }

    function populatemenu(what){
    if (ie4||ns6)
    dropmenuobj.innerHTML=what.join("")
    }

    function dropdownmenu(obj, e, menucontents, menuwidth){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)

    if (ie4||ns6){
    showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
    dropmenuobj.x=getposOffset(obj, "left")
    dropmenuobj.y=getposOffset(obj, "top")
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }

    return clickreturnvalue()
    }

    function clickreturnvalue(){
    if (ie4||ns6) return false
    else return true
    }

    function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
    }

    function dynamichide(e){
    if (ie4&&!dropmenuobj.contains(e.toElement))
    delayhidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhidemenu()
    }

    function hidemenu(e){
    if (typeof dropmenuobj!="undefined"){
    if (ie4||ns6)
    dropmenuobj.style.visibility="hidden"
    }
    }

    function delayhidemenu(){
    if (ie4||ns6)
    delayhide=setTimeout("hidemenu()",disappeardelay)
    }

    function clearhidemenu(){
    if (typeof delayhide!="undefined")
    clearTimeout(delayhide)
    }

    if (hidemenu_onclick=="yes")
    document.onclick=hidemenu
    </script>
    I've setup a demo account which can be accessed at the URL below, all you need to do is login and then click the "User CP" button when it asks what panel you want to use. The menu I'm talking about is the one in the User CP that is along the top (horizontally) and has links such as "Radio", "Chat", "DJ Tools", "Messaging", etc.

    URL: http://quickscriptz.ca/djpanel4/
    User: DD-Demo
    Pass: password

    Any help is greatly appreciated! Thanks!

    P.S. I'm not sure if the errors is happening in FF but it is definitely a problem in IE 6.

  2. #2
    Join Date
    Sep 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Update: I've tried it and the error still happens in Maxthon (which uses the IE6 rendering engine).

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
  •