Results 1 to 7 of 7

Thread: Need Help with Any Link Drop Down Menu

  1. #1
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help with Any Link Drop Down Menu

    1) Script Title: Any Link Drop Down Menu (mouseover)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...pmenuindex.htm

    3) Describe problem: I have successfully implemented this script on my page and was able to get all of my naviagtion links working perfectly. Then all of a sudden they stopped working (the links still work the mouseover menu does not). I thought it was b/c of another change I made so I reverted back to when it was working and still didn't work. I created a whole new page starting with only this script and worked one link at a time, it will work a few times, then suddenly stops working. I am using Firefox 1.5 as my browser each time. I can't explain it, it's weird. I'm also using NVU to create my page, might that have something to do with it?

    Any thoughts?

    Thanks!

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Could you post a link to the problem page. It would help us to help you find a solution a lot faster.

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Please post a link to the page on your site that contains the problematic script so we can check it out.

    Always wanted to use one of those
    - Mike

  4. #4
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well - I'm only working locally right now so I haven't uploaded it to a site yet. I will paste the html below. Thanks so much for taking a look. I know it's not pretty and it's in tables. I'm a complete amateur but sadly of the 3 of us getting this little non-profit rolling I know the most about web design.

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <style type="text/css">
    #dropmenudiv{
    position:absolute;
    border:1px solid black;
    border-bottom-width: 0;
    font:normal 12px Verdana;
    line-height:18px;
    z-index:100;
    }
    #dropmenudiv a{
    width: 100%;
    display: block;
    text-indent: 3px;
    border-bottom: 1px solid black;
    padding: 1px 0;
    text-decoration: none;
    font-weight: bold;
    }
    #dropmenudiv a:hover{ /*hover background color*/
    background-color: yellow;
    }
    </style>
    <script type="text/javascript">
    /***********************************************
    * AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    //Contents for menu 1 Our Organization
    var menu1=new Array()
    menu1[0]='<a href="ourorganization.html">Overview</a>'
    menu1[1]='<a href="ourorganization.html">Our Core Programs</a>'
    menu1[2]='<a href="ourorganization.html">The SNJ Difference</a>'
    menu1[3]='<a href="ourorganization.html">Who We Are</a>'
    menu1[4]='<a href="ourorganization.html">Our Partners</a>'
    //Contents for menu 2 Parents, Schools and Students
    var menu2=new Array()
    menu2[0]='<a href="pts.html">Parents' Corner</a>'
    menu2[1]='<a href="pts.html">Information for Schools</a>'
    menu2[2]='<a href="pts.html">Student Forum</a>'
    menu2[3]='<a href="pts.html">Forms</a>'
    //Contents for menu 3 Donate and Support
    menu3[0]='<a href="donate.html">How Can I Help?</a>'
    menu3[1]='<a href="donate.html">Donate Online</a>'
    var menu3=new Array()
    //Contents for menu 4 Contact Us
    menu4[0]='<a href="contact.html">General Inquiries</a>'
    menu4[1]='<a href="contact.html">Employment Opportunities</a>'
    var menu4=new Array()
    var menuwidth='200px' //default menu width
    var menubgcolor='lightgray' //menu bgcolor
    var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
    var hidemenu_onclick="yes" //hide menu when user clicks within menu?
    /////No further editting needed
    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=="left")? 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=="rightedge"){
    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){ //move up?
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
    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) {
    if (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>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <title>Sierra Nevada Journeys</title>
    <meta content="Home Page" name="description">
    </head>
    <body
    style="color: rgb(0, 0, 0); background-color: rgb(202, 202, 202); background-image: url(pleadies.jpg);"
    alink="#3366ff" link="#3366ff" vlink="#990099">
    <table align="center" border="1" cellpadding="2"
    cellspacing="2" width="78%">
    <tbody>
    <tr>
    <td bgcolor="#333333" height="100%" width="100%">
    <table bgcolor="#ffffff" border="1"
    cellpadding="0" cellspacing="0" width="100%">
    <tbody>
    <tr>
    <td width="40%">Logo</td>
    <td width="60"><img alt="Banner Picture"
    src="New%20Folder/On%20Top%20of%20the%20World%20Banner.jpg"
    height="116" width="586"></td>
    </tr>
    </tbody>
    </table>
    <i><font color="#ffffff">Empowering Youth
    Through Positive Risk-Taking, Experiential Leadership, Science and
    Outdoor Education</font><br>
    <br>
    </i>
    <table bgcolor="#000000" border="0"
    cellpadding="0" cellspacing="0" height="57"
    width="983">
    <tbody>
    <tr>
    <td align="center" valign="middle"><b><font
    color="#ffffff" face="Helvetica, Arial, sans-serif">Home
    &nbsp; &nbsp; &nbsp; &nbsp;
    <a href="ourorganization.html"
    onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event, menu1, '150px')"
    onmouseout="delayhidemenu()">Our Organization</a>
    &nbsp; &nbsp; &nbsp; &nbsp;
    <a href="tps.html"
    onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event, menu2, '150px')"
    onmouseout="delayhidemenu()">Parents, Schools &amp; Students</a> &nbsp; &nbsp; &nbsp; &nbsp;
    <a href="donate.html" onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event, menu3, '150px')"
    onmouseout="delayhidemenu()">Donate &amp; Support</a>
    &nbsp; &nbsp; &nbsp; &nbsp;
    <a href="contact.html"
    onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event, menu4, '150px')"
    onmouseout="delayhidemenu()">Contact Us</a><br>
    </font></b><br>
    </td>
    </tr>
    </tbody>
    </table>
    <table border="1" cellpadding="0" cellspacing="0"
    height="392" width="983">
    <tbody>
    <tr>
    <td align="center" bgcolor="#ffffcc"
    width="20%">Pictures and Quotes/Navigation</td>
    <td align="center" bgcolor="#ffffff"
    width="80%"><font face="Helvetica, Arial, sans-serif">Main
    About SNJ Home Page</font></td>
    </tr>
    </tbody>
    </table>
    <table bgcolor="#000000" border="1"
    cellpadding="0" cellspacing="0" height="95"
    width="983">
    <tbody>
    <tr>
    <td align="center" width="50%"><b><font
    color="#ffffff" face="Helvetica, Arial, sans-serif">Research
    &amp; Our Favorites</font></b></td>
    <td align="center" width="50%"><font
    color="#ffffff" face="Helvetica, Arial, sans-serif">News
    Releases &amp; Press</font></td>
    </tr>
    </tbody>
    </table>
    <table border="0" cellpadding="0" cellspacing="0"
    width="100%">
    <tbody>
    <tr>
    <td bgcolor="#009900"><font color="#ffffff"
    face="Helvetica, Arial, sans-serif">Sierra Nevada Journeys
    &nbsp;| &nbsp; Phone: &nbsp;775-560-3345 &nbsp;|
    &nbsp;Email: &nbsp;jonathan@sierranevadajourneys.org</font></td>
    </tr>
    </tbody>
    </table>
    </td>
    </tr>
    </tbody>
    </table>
    <br>
    </body>
    </html>

  5. #5
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here is a link to one page that is using this script. I've still been able to get it to work a few times then it just stops working. I know it doesn't make sense, any help would be greatly appreciated.

    Thanks

    http://kimberlysomma.googlepages.com/Index.html

  6. #6
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Ok. I think I found your problem and it lies in the code. Find the following line:

    Code:
    var menu2=new Array()
    menu2[0]='<a href="tpsparents.html">Parents' Corner</a>'
    menu2[1]='<a href="tpsschools.html">Information for Schools</a>'
    and try escaping that quote after "Parents" like so:

    Code:
    var menu2=new Array()
    menu2[0]='<a href="tpsparents.html">Parents\' Corner</a>'
    menu2[1]='<a href="tpsschools.html">Information for Schools</a>'
    That should fix your problem. Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  7. #7
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Thank you so much! That seems to have fixed it - maybe I'll get this site up after all.

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
  •