Problemer med dropdownmenu
Jeg har hentet scriptet til en dropdown menu ude på internettet. På hjemmesiden anvendes en rammeside, og problemer er nu at undermenuerne ikke vil går ned over en anden side. Dvs. der kommer en irriterende scrollknap.Hvis det har nogen interesse ser mit script sådan ud:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Generel information</title>
<STYLE>A:hover {COLOR: #ffcc99; text-decoration: none;}
#divBg {HEIGHT: 20px; center: 100px; POSITION: absolute; TOP: 0px; VISIBILITY: hidden; width=100%;}
#divBgColor {BACKGROUND-COLOR: #008000; HEIGHT: 20px; LEFT: 0px; POSITION: absolute; TOP: 0px; WIDTH: 100%; layer-background-color: white}
DIV.clSub {BACKGROUND-COLOR: #008000; FONT-FAMILY: verdana,arial,helvetica; FONT-SIZE: 9px; FONT-WEIGHT: normal; LEFT: 2px; PADDING-BOTTOM: 0px; PADDING-LEFT: 4px; PADDING-RIGHT: 2px; PADDING-TOP: 4px; POSITION: absolute; TOP: 15px; VISIBILITY: hidden; WIDTH: 100px; layer-background-color: black}
DIV.clTop {font-color: white; FONT-FAMILY: verdana,arial,helvetica; FONT-SIZE: 12px; FONT-WEIGHT: bold; LEFT: 10px; POSITION: absolute; TOP: 0px; VISIBILITY: visible}
#divTop0 {LEFT: 2%; TOP: 5px}
#divTop1 {LEFT: 23%; TOP: 5px}
#divTop2 {LEFT: 40%; TOP: 5px}
#divTop3 {LEFT: 55%; TOP: 5px}
#divTop4 {LEFT: 85%; TOP: 5px}
</STYLE>
</head>
<SCRIPT language=JavaScript1.2>
/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
********************************************************************************
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
Browsercheck:*/
ie=document.all?1:0
n=document.layers?1:0
//Do you want it to move with the page if the user scroll the page?
var moveOnScroll=true
numberOfMenus=5//How many menus do you have
//Do you want to hide all the other submenus when you click a new?
var hideAll=true
/********************************************************************************
If you want to change the appearans on the text, or background or anything
do that in the style tag above, or in the table tag below.
The different event handling on the different browsers makes this a little
tricky. I had to make all divs absolute positioned to make it work in netscape.
So if you ad or remove menuitems please play with the % values of each divTop
in the stylesheet. I have not had all that much luck with % placement before
in netscape so if you encounter any errors let me know and I'll see what I can do.
********************************************************************************/
/********************************************************************************
Object constructor
********************************************************************************/
function makeMenuBar(obj,nest,vis){
nest=(!nest) ? '':'document.'+nest+'.'
this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style')
this.hideIt=b_hideIt; this.showIt=b_showIt
if(ie && vis) this.css.visibility='hidden'
this.evnt=(n)? eval(nest+'document.'+obj):eval(obj);
this.go=0
this.height=n?this.css.document.height:eval(obj+'.offsetHeight')
this.top=b_gettop
this.obj = obj + "Object"; eval(this.obj + "=this")
}
//Get's the top position.
function b_gettop(){
var gleft=(n) ? eval(this.css.top):eval(this.css.pixelTop);
return gleft;
}
//The functions for showing and hiding
function b_showIt(){
this.css.visibility="visible"
}
function b_hideIt(){
this.css.visibility="hidden"
}
/********************************************************************************
Checking if the page is scrolled, if it is move the menu after
********************************************************************************/
function checkScrolled(){
if(!oMenu.go)oMenu.css.top=(!oMenu.state)?eval(scrolled):eval(scrolled)
if(n) setTimeout('checkScrolled()',30)
}
/********************************************************************************
Inits the page, makes the menu object, moves it to the right place,
show it..
********************************************************************************/
function menuBarInit(){
oSub=new Array()
oTop=new Array()
for(i=0;i<numberOfMenus;i++){
oTop[i]=new makeMenuBar('divTop'+i,'divBg')
oSub[i]=new makeMenuBar('divSub'+i,'divBg.document.divTop'+i,1)
oSub[i].evnt.onmouseout=evOut;
}
//Moving menuBar
oMenu=new makeMenuBar('divBg')
scrolled=n?"window.pageYOffset":"document.body.scrollTop"
oMenu.css.top=eval(scrolled)
oMenu.css.visibility='visible'
if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();
}
/********************************************************************************
Shows and hides the submenus
********************************************************************************/
function evOut(){
if(ie)this.style.visibility='hidden'
else if(n) this.visibility='hidden'
}
//Canceling event bubbling in ie
function ieShow(num){
if(ie){
oSub[num].showIt()
window.event.cancelBubble=true
}
}
function extract(num){
if(hideAll){
for(i=0;i<oSub.length;i++){
if(num!=i) oSub[i].hideIt()
}
}
oSub[num].showIt();
}
onload=menuBarInit;
</SCRIPT>
<body vlink="#0000FF" alink="#0000FF" bgcolor="#008000">
<DIV id=divBg>
<DIV id=divBgColor style="width: 320; height: 20"></DIV>
<DIV class=clTop id=divTop0 style="width: 660; height: 19"><A
href="../index.html#"
onmouseover=extract(0)>Generel information</A>
<DIV class=clSub id=divSub0><A
href="../index.html#"
onmouseout=ieShow(0) onmouseover=ieShow(0)>Adresse oplysninger</A> <BR><A
href="../index.html#"
onmouseout=ieShow(0) onmouseover=ieShow(0)>Fakta oplysninger</A><BR><A
href="../index.html#"
onmouseout=ieShow(0) onmouseover=ieShow(0)>Beskrivelse af kommunen</A><BR><A
href="../index.html#"
onmouseout=ieShow(0) onmouseover=ieShow(0)>Lokalplan</A><BR><A
href="../index.html#"
onmouseout=ieShow(0) onmouseover=ieShow(0)>Servicestrategi</A><BR><A
href="../index.html#"
onmouseout=ieShow(0) onmouseover=ieShow(0)>Udbudspolitik</A><BR><BR></DIV></DIV>
<DIV class=clTop id=divTop1><A
href="../index.html#"
onmouseover=extract(1)>Erhvervslivet</A>
<DIV class=clSub id=divSub1><A
href="../index.html#"
onmouseout=ieShow(1) onmouseover=ieShow(1)>Generelt</A> <BR>
<A href="../index.html#"
onmouseout=ieShow(1) onmouseover=ieShow(1)>Erhverskonsulenten</A><BR>
<A href="../index.html#"
onmouseout=ieShow(1) onmouseover=ieShow(1)>Kong Svends Park</A><BR>
<A href="../index.html#"
onmouseout=ieShow(1) onmouseover=ieShow(1)>Erhvervsbog</A><BR>
<A href="../index.html#"
onmouseout=ieShow(1) onmouseover=ieShow(1)>Brancheoversigt</A><BR>
<BR></DIV></DIV>
<DIV class=clTop id=divTop2><A
href="../index.html#"
onmouseover=extract(2)>Byrådet</A>
<DIV class=clSub id=divSub2><A
href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Ledøje-Smørum Byråd</A> <BR><A
href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Dagsorden til næste møde</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Referat fra sidste møde</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Mødekalender 2003</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Tidligere byrådsreferater 2003</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Tidligere byrådsreferater 2002</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Tidligere byrådsreferater 2001</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Tidligere byrådsreferater 2000</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Økonomiudvalget</A><BR>
<A href="../index.html#"
onmouseout=ieShow(2) onmouseover=ieShow(2)>Stående udvalg</A><BR>
<BR></DIV></DIV>
<DIV class=clTop id=divTop3><A
href="../index.html#"
onmouseover=extract(3)>Kommunale servicedeklarationer</A>
<DIV class=clSub id=divSub3><A
href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Hvad er servicedeklarationer</A> <BR><A
href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Administartion</A><BR><A
href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Skolevæsenet</A><BR>
<A href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Biblioteket</A><BR>
<A href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Fritidsområdet</A><BR>
<A href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Dagpasningstilbud</A><BR>
<A href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Ældreområdet</A><BR>
<A href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Sundhedsplejen</A><BR>
<A href="../index.html#"
onmouseout=ieShow(3) onmouseover=ieShow(3)>Tandplejen</A><BR>
<BR></DIV></DIV>
<DIV class=clTop id=divTop4><A
href="../index.html#"
onmouseover=extract(4)>Diverse</A>
<DIV class=clSub id=divSub4><A
href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Stillinger</A> <BR><A
href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Selvbetjening</A><BR><A
href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Ledøje-Smørum fra A-Z</A><BR><A
href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Borgerinformation</A><BR>
<A href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>E-Boks</A><BR>
<A href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Grundsalg</A><BR>
<A href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Daginstitutioner</A><BR>
<A href="../index.html#"
onmouseout=ieShow(4) onmouseover=ieShow(4)>Links</A><BR>
<BR></DIV></DIV></DIV>
</body>
</html>
