Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Menu trouble

  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Menu trouble

    I'm trying to put this function:

    Code:
    <head>
    <SCRIPT Language=JavaScript>
    function ChangeFrames(URL1, URL2)
    {
       parent.main.document.location.href = URL1;
       parent.right.document.location.href = URL2;
    }
    </SCRIPT>
    </head>
    
    <body>
    <A HREF="javascript:ChangeFrames('m_om.html','omom.html');"></a>
    </body>
    into this menus (both image menu and submenu):

    Code:
    <html>
    <head>
    
    <style>
    a.menu2 {
    		font-family: Verdana, Geneva, Arial;
    		font-size: 11px;
    		color: #000000;
    		text-decoration: none;
    }
    .text {
    		font-family: Verdana, Geneva, Arial;
    		font-size: 11px;
    }
    </style>
    
    <SCRIPT language="JavaScript">
    function move_in(img_name,img_src) {
    document[img_name].src=img_src;
    }
    function move_out(img_name,img_src) {
    document[img_name].src=img_src;
    }
    // End -->
    </SCRIPT>
    
    	<title></title>
    </head>
    
    <body leftmargin=0 topmargin=0 marginwidth="0" marginheight="0" background="images/topbak.jpg">
    
    <table cellspacing="0" cellpadding="0" border="0">
    <tr><td><img src="images/top2.jpg" alt="" border="0"></td></tr>
    <tr>
        <td background="images/menubak.gif"><A HREF="ompaulus.html" onmouseover="move_in('ompaulus','images/kn_ompaulus_2.gif');showit(0)" onmouseout="move_out('ompaulus','images/kn_ompaulus_1.gif')" target="main"><img name="ompaulus" src="images/kn_ompaulus_1.gif" border="0"></a><img src="images/menudots.gif" border="0"><A HREF="paulvarld.html" onmouseover="move_in('paulvarld','images/kn_paulvarld_2.gif');showit(1)" onmouseout="move_out('paulvarld','images/kn_paulvarld_1.gif')" target="main"><img name="paulvarld" src="images/kn_paulvarld_1.gif" border="0"></a><img src="images/menudots.gif" border="0"><A HREF="resorna.html" onmouseover="move_in('resorna','images/kn_resorna_2.gif');showit(2)" onmouseout="move_out('resorna','images/kn_resorna_1.gif')" target="main"><img name="resorna" src="images/kn_resorna_1.gif" border="0"></a><img src="images/menudots.gif" border="0"><A HREF="breven.html" onmouseover="move_in('breven','images/kn_breven_2.gif');showit(3)" onmouseout="move_out('breven','images/kn_breven_1.gif')" target="main"><img name="breven" src="images/kn_breven_1.gif" border="0"></a><img src="images/menudots.gif" border="0"><A HREF="ovrigt.html" onmouseover="move_in('ovrigt','images/kn_ovrigt_2.gif');showit(4)" onmouseout="move_out('ovrigt','images/kn_ovrigt_1.gif')" target="main"><img name="ovrigt" src="images/kn_ovrigt_1.gif" border="0"></a><img src="images/spacer.gif" width="100" height="1" border="0"><img src="images/menuend.gif" border="0"></td>
    </tr>
    <tr><td><img src="images/spacer.gif" height="3" border="0"></td></tr>
    <tr>
    <td><ilayer name="dep1" bgColor="#FFFFFF">
    <layer name="dep2">
    </layer>
    </ilayer>
    <div id="describe" style="background-color:#FFFFFF" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div></td>
    </tr>
    </table>
    
    <script language="JavaScript1.2">
    
    var submenu=new Array()
    
    submenu[0]='<font class="text2">&nbsp;&nbsp;<a href="ompaulus.html" class="menu2" target="main">Om Paulus</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="utseende.html" class="menu2" target="main">Utseende</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="uppvaxt.html" class="menu2" target="main">Uppväxt</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="utbildning.html" class="menu2" target="main">Utbildning</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="tro.html" class="menu2" target="main">Tro</a></font>'
    
    submenu[1]='<font class="text2">&nbsp;&nbsp;<a href="paulvarld.html" class="menu2" target="main">Paulus värld</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="omvarld.html" class="menu2" target="main">Omvärlden</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="sprak.html" class="menu2" target="main">Språk</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="kultur.html" class="menu2" target="main">Kultur</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="religion.html" class="menu2" target="main">Religion</a></font>'
    
    submenu[2]='<font class="text2">&nbsp;&nbsp;<a href="resorna.html" class="menu2" target="main">Resorna</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="resorna/1resan.html" class="menu2" target="main">Första resan</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="resorna/2resan.html" class="menu2" target="main">Andra resan</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="resorna/3resan.html" class="menu2" target="main">Tredje resan</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="resorna/romresan.html" class="menu2" target="main">Resan till Rom</a></font>'
    
    submenu[3]='<font class="text2">&nbsp;&nbsp;<a href="ovrigt.html" class="menu2" target="main">Breven</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="ovrigt/lankar.html" class="menu2" target="right">Kronologi</a></font>'
    
    submenu[4]='<font class="text2">&nbsp;&nbsp;<a href="ovrigt.html" class="menu2" target="main">Övrigt</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="ovrigt/lankar.html" class="menu2" target="right">Länkar</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="bbs.html" class="menu2" target="main">BBS</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="kontakta.html" class="menu2" target="main">Kontakta oss</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="rekomm.html" class="menu2" target="main">Rekommendera oss</a></font>'
    
    var delay_hide=500
    
    var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""
    
    function showit(which){
    clear_delayhide()
    thecontent=(which==-1)? "" : submenu[which]
    if (document.getElementById||document.all)
    menuobj.innerHTML=thecontent
    else if (document.layers){
    menuobj.document.write(thecontent)
    menuobj.document.close()
    }
    }
    
    function resetit(e){
    if (document.all&&!menuobj.contains(e.toElement))
    delayhide=setTimeout("showit(-1)",delay_hide)
    else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhide=setTimeout("showit(-1)",delay_hide)
    }
    
    function clear_delayhide(){
    if (window.delayhide)
    clearTimeout(delayhide)
    }
    
    function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
    }
    
    </script>
    
    </body>
    </html>
    How do i do that?

    Mike //

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Remove the target and try something like this:

    Code:
    <a href="ompaulus.html"
    onclick="ChangeFrames(this.href,'omom.html');return false"
    onmouseout="move_out('ompaulus','images/kn_ompaulus_1.gif')" 
    onmouseover="move_in('ompaulus','images/kn_ompaulus_2.gif');showit(0)">

  • #3
    New Coder
    Join Date
    Sep 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Haja, haja!

    Good, it works in the image menu but in the submenu i get errors. I can't use the ' character in there:

    Code:
    submenu[0]='<font class="text2">&nbsp;&nbsp;<a href="ompaulus.html" class="menu2" target="main">Om Paulus</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="utseende.html" class="menu2" target="main">Utseende</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="uppvaxt.html" class="menu2" target="main">Uppväxt</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="utbildning.html" class="menu2" target="main">Utbildning</a>&nbsp;&nbsp;:&nbsp;&nbsp;<a href="tro.html" class="menu2" target="main">Tro</a></font>'
    How do i write in this menu with the use of the same as the image menu?

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Escape the single quotes with a backslash.

  • #5
    New Coder
    Join Date
    Sep 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could you please show me?

  • #6
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ChangeFrames(this.href,\'omom.html\');

  • #7
    New Coder
    Join Date
    Sep 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope!
    Doesn't work. The submenu doesn't show at all.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •