...

View Full Version : Menu trouble



midez
05-30-2004, 10:18 PM
I'm trying to put this function:


<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):


<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 //

Willy Duitt
05-30-2004, 11:32 PM
Remove the target and try something like this:


<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)">

midez
05-31-2004, 07:35 AM
Good, it works in the image menu but in the submenu i get errors. I can't use the ' character in there:


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?

Willy Duitt
05-31-2004, 09:29 AM
Escape the single quotes with a backslash.

midez
05-31-2004, 09:42 PM
Could you please show me? :confused:

Willy Duitt
05-31-2004, 10:31 PM
ChangeFrames(this.href,\'omom.html\');

midez
06-01-2004, 04:11 PM
Nope!
Doesn't work. The submenu doesn't show at all.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum