PDA

View Full Version : Tab Mouseover Submenu Problem



bondb2000
06-05-2005, 05:02 PM
I am using the Tab Menu (Mouseover) (http://www.dynamicdrive.com/dynamicindex1/tabmouseover.htm)

This is the code i am using (I edited it for my site):
<script language="JavaScript1.2">

/*
Tabs Menu (mouseover)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.

submenu[0]='<font size="2" face="Verdana"><b><a href="KCAlbums/03-04/Asthma%20Walk-a-Thon/album0.html">Asthma Walk-a-Thon</a> | <a href="KCAlbums/03-04/Beach%20Cleanup/album0.html">Beach Cleanup</a> | <a href="KCAlbums/03-04/Car%20Wash/album0.html">Car Wash</a> | <a href="KCAlbums/03-04/Halloween%20Parade/album0.html">Halloween Parade</a> | <a href="KCAlbums/03-04/PBJ-a-Thon/album0.html">PBJ-a-Thon</a> | <a href="KCAlbums/03-04/PBJ-a-Thon2/album0.html">PBJ-a-Thon2</a> | <a href="KCAlbums/03-04/Radio-a-Thon/album0.html">Radio-a-Thon</a> | <a href="KCAlbums/03-04/Spin-a-Thon/album0.html">Spin-a-Thon</a> | <a href="KCAlbums/03-04/SSP/album0.html">SSP</a> | <a href="KCAlbums/03-04/Teacher%20Appreciation%20Day/album0.html">Teacher Appreciation Day</a></b></font>'

submenu[1]='<font size="2" face="Verdana"><b><a href="KCAlbums/04-05/Animal%20Rescue%20League/album0.html">Peggy Adams</a> | <a href="KCAlbums/04-05/Arden%20Court/album0.html">Arden Court</a> | <a href="KCAlbums/04-05/Book%20Fair/album0.html">Book Fair,/a> | <a href="KCAlbums/04-05/Parent%20Night/album0.html">Parent Night</a> | <a href="KCAlbums/04-05/Scrub%20Cleanup/album0.html">Scrub Cleanup</a> | <a href="KCAlbums/04-05/Christmas%20Caroling/album0.html">Christmas Caroling</a> | <a href="KCAlbums/04-05/Dinner%20at%20Ellie%27s/album0.html">Dinner at Ellie's</a> | <a href="KCAlbums/04-05/coldstone%27s/album0.html">Coldstone's</a> | <a href="KCAlbums/04-05/pbj-a-thon/album0.html">PBJ-a-Thon</a> | <a href="KCAlbums/04-05/Convention/1/album0.html">Convention (Album-1)</a> | <a href="KCAlbums/04-05/Convention/2/album0.html">Convention (Album-2)</a></b></font>'

//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

/////No need to edit beyond here

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>

However niether of the submenus appear upon mousover. When I leave submenu[1] undefined the submenus appear. Can someone help my fix this error so that I can have both submenus appear?

jscheuer1
06-05-2005, 05:30 PM
Unless there are other problems I missed, you simply omitted the \ for single quotes that need to be escaped in the submenu[1]= declaration, here is a 'proper' one:
submenu[1]='<font size="2" face="Verdana"><b><a href="KCAlbums/04-05/Animal%20Rescue%20League/album0.html">Peggy Adams</a> | <a href="KCAlbums/04-05/Arden%20Court/album0.html">Arden Court</a> | <a href="KCAlbums/04-05/Book%20Fair/album0.html">Book Fair,/a> | <a href="KCAlbums/04-05/Parent%20Night/album0.html">Parent Night</a> | <a href="KCAlbums/04-05/Scrub%20Cleanup/album0.html">Scrub Cleanup</a> | <a href="KCAlbums/04-05/Christmas%20Caroling/album0.html">Christmas Caroling</a> | <a href="KCAlbums/04-05/Dinner%20at%20Ellie%27s/album0.html">Dinner at Ellie\'s</a> | <a href="KCAlbums/04-05/coldstone%27s/album0.html">Coldstone\'s</a> | <a href="KCAlbums/04-05/pbj-a-thon/album0.html">PBJ-a-Thon</a> | <a href="KCAlbums/04-05/Convention/1/album0.html">Convention (Album-1)</a> | <a href="KCAlbums/04-05/Convention/2/album0.html">Convention (Album-2)</a></b></font>'ex:
use:
Ellie\'s
instead of:
Ellie's

bondb2000
06-06-2005, 10:40 PM
That worked. Thanks!