Avatar billede tingholm Mester
06. oktober 2002 - 11:29 Der er 12 kommentarer og
1 løsning

dropdownmenu virker ikke !!

jeg har brug en kode til en dropdownmenu (anbefalet af callesen http://www.eksperten.dk/spm/161113) men jeg kan ikke få den til at virke, siden er simpelthen tom ! kan en rette koden eller give en ny som virker ??

kode:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>Menu</title>
<link href="stylesheets/stylesheet.css" rel="stylesheet" type="text/css">
<meta name="generator" content="TSW WebCoder">
<!-- Minus AutoDato -->
    <TITLE>[Ingen titel]</TITLE>
<META NAME=\"Generator\" CONTENT=\"Stone\'s WebWriter 3\">
<style type=\"text/css\">
<!-- a.x:link, a.x:visited, a.x:active{color:#ffffff;text-decoration:none} //-->
</style>
</head>
<body marginheight=\"50\" topmargin=\"50\">
<script language=\"JavaScript\">
<!-- Cross Browser NavBar2 (Not NS6)
if (document.layers||document.all){

MenuTitles=new Array()
SubMenuLinks=new Array()
function Rtrn(c){
if (document.layers) c.bgColor=HighLight;
if (document.all) c.style.background=HighLight;
}
function HghLght(c){
if (document.layers) c.bgColor=MenuBgColor;
if (document.all) c.style.background=MenuBgColor;
}
OpenLayer=(document.layers)?\"<br><layer width=100% onMouseOver=\'HghLght(this)\'; onMouseOut=\'Rtrn(this)\'><center>\":\"<span style=\'width:100%\' onMouseOver=\'HghLght(this)\'; onMouseOut=\'Rtrn(this)\'>\";
CloseLayer=(document.layers)?\'</center></layer>\':\'</span>\';

/*Her indstilles udseendet*/

MenuWidth=500;
MenuFont=\'Verdana,Arial\';
MenuFontSize=2; //kun mellem 1 to 7
SubMenuFontSize=1; //kun mellem 1 to 7

MenuFontColor=\'#000000\';
MenuBgColor=\'DDF9DB\';
HighLight=\'AEFCA6\';
Separater=2;

/*Menu antal - slet eller tilføj*/

MenuTitles[0]=\'Forside\';
MenuTitles[1]=\'Klubber\';
MenuTitles[2]=\'Biografer\';
MenuTitles[3]=\'Spil\';
MenuTitles[4]=\'Sport\';


/*Undermenuer. Ændr ikke:  +OpenLayer+\"  eller  \"+CloseLayer
Sådan udfyldes links. Eksempel:
+OpenLayer+\"<a href=\'http://www.google.com\' class=\'x\'>Google</a>\"+CloseLayer
*/

SubMenuLinks[0]=\"\"
+OpenLayer+\"<a href=\'http://www.ungfritid.dk\' class=\'x\'>Ungfritid</a>\"+CloseLayer

SubMenuLinks[1]=\"\"
+OpenLayer+\"<a href=\'klub/njylland.shtml\' class=\'x\'>Nordjylland</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/sjylland.shtml\' class=\'x\'>S&oslash;nderjylland</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/fyn.shtml\' class=\'x\'>Fyn og &oslash;erne</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/sjlland.shtml\' class=\'x\'>Sj&aelig;lland</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/kbh.shtml\' class=\'x\'>K&oslash;benhavn</a>\"+CloseLayer

SubMenuLinks[2]=\"\"
+OpenLayer+\"<a href=\'klub/njylland.shtml\' class=\'x\'>Nordjylland</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/sjylland.shtml\' class=\'x\'>S&oslash;nderjylland</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/fyn.shtml\' class=\'x\'>Fyn og &oslash;erne</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/sjlland.shtml\' class=\'x\'>Sj&aelig;lland</a>\"+CloseLayer
+OpenLayer+\"<a href=\'klub/kbh.shtml\' class=\'x\'>K&oslash;benhavn</a>\"+CloseLayer

SubMenuLinks[3]=\"\"
+OpenLayer+\"<a href=\'spil/nyeste.shtml\' class=\'x\'>De nyeste</a>\"+CloseLayer
+OpenLayer+\"<a href=\'spil/bedste.shtml\' class=\'x\'>De bedste</a>\"+CloseLayer
+OpenLayer+\"<a href=\'spil/klassiske.shtml\' class=\'x\'>De klassiske</a>\"+CloseLayer
+OpenLayer+\"<a href=\'spil/rolle.shtml\' class=\'x\'>Live Rollespil</a>\"+CloseLayer

SubMenuLinks[4]=\"\"
+OpenLayer+\"<a href=\'sport/fodbold.shtml\' class=\'x\'>Fodbold</a>\"+CloseLayer
+OpenLayer+\"<a href=\'sport/hndbold.shtml\' class=\'x\'>H&aring;ndbold</a>\"+CloseLayer
+OpenLayer+\"<a href=\'sport/liste.shtml\' class=\'x\'>Komplet liste</a>\"+CloseLayer

/*Dette bør ikke ændres:*/
MenuAmount=MenuTitles.length;
MenWidth=0;
PageWidth=0;
IniPos=0;
Spacer=0;
aIniPos=0;
aSpacer=0;
function Pos(){
MenWidth=(MenuWidth+Separater)*MenuAmount;
PageWidth=(document.layers)?window.innerWidth/2:document.body.clientWidth/2;
IniPos= PageWidth-MenuWidth-Separater-MenWidth/2;
Spacer=MenuWidth+Separater;
aIniPos= PageWidth-MenuWidth-Separater-MenWidth/2;
aSpacer=MenuWidth+Separater;
if (MenWidth > PageWidth*2){
IniPos=-MenuWidth-Separater;
aIniPos=-MenuWidth-Separater;
}
}
Pos();
if (document.layers){
for (i=0; i < MenuAmount; i++){
document.write(\"<layer name=\'submenu\"+i+\"\' top=0 left=\"+(aIniPos+=aSpacer)+\" \"
+\" width=\"+MenuWidth+\" bgcolor=\"+HighLight+\" visibility=hide\"
+\" onMouseOver=\'this.visibility=\\\"show\\\"; var cd=this.id.length-1; var ab=this.id.charAt(cd); H(ab)\' \"
+\" onMouseOut=\'this.visibility=\\\"hide\\\"; var ef=this.id.length-1; var gh=this.id.charAt(ef); B(gh)\'>\"
+\"<center><font face=\"+MenuFont+\" size=\"+SubMenuFontSize+\">\"
+\"&nbsp;<br>\"+SubMenuLinks[i]+\"<br></font></center></layer>\");
}
for (i=0; i < MenuAmount; i++){
document.write(\"<layer name=\'nsmenu\"+i+\"\' top=0 left=\"+(IniPos+=Spacer)+\" height=0 \"
+\"width=\"+MenuWidth+\" bgcolor=\"+MenuBgColor+\" \"
+\"onMouseOver=\\\"this.bgColor=HighLight; var e=this.id.length-1; var d=this.id.charAt(e); On(d)\\\" \"
+\"onMouseOut=\\\"this.bgColor=MenuBgColor; var e=this.id.length-1; var d=this.id.charAt(e); Off(d)\\\">\"
+\"<center><font face=\"+MenuFont+\" size=\"+MenuFontSize+\" color=\"+MenuFontColor+\">\"
+MenuTitles[i]+\"</font></center></layer>\");                                     
}
function On(x){
for (i=0; i < MenuAmount; i++){
document.layers[\'submenu\'+x].visibility=\'show\';
}
}
function Off(x){
for (i=0; i < MenuAmount; i++){
document.layers[\'submenu\'+x].visibility=\'hide\';
}
}
function B(y){
for (i=0; i < MenuAmount; i++){
document.layers[\'nsmenu\'+y].bgColor=MenuBgColor;
}
}
function H(y){
for (i=0; i < MenuAmount; i++){
document.layers[\'nsmenu\'+y].bgColor=HighLight;
}
}
}
if (document.all){
for (i=0; i < MenuAmount; i++){
document.write(\"<div id=\'sub\"+i+\"\' style=\'position:absolute;\"
+\"top:100px;\"
+\"left:\"+(aIniPos+=aSpacer)+\";\"
+\"height:0px;\"
+\"width:\"+MenuWidth+\";\"
+\"background:\"+HighLight+\";\"
+\"visibility:hidden\'\"
+\" onMouseOver=\'this.style.visibility=\\\"visible\\\";\"
+\" document.all[\\\"headers\"+i+\"\\\"].style.background=HighLight\';\"
+\" onMouseOut=\'this.style.visibility=\\\"hidden\\\";\"
+\" document.all[\\\"headers\"+i+\"\\\"].style.background=MenuBgColor\'>\"
+\"<center><font face=\"+MenuFont+\" size=\"+SubMenuFontSize+\">\"
+\"&nbsp;<br>&nbsp;<br>\"+SubMenuLinks[i]+\"</font></center></div>\");
}
for (i=0; i < MenuAmount; i++){
document.write(\"<div id=\'headers\"+i+\"\' style=\'position:absolute;\" 
+\"top:100px;\"
+\"left:\"+(IniPos+=Spacer)+\";\"
+\"height:0px;\"
+\"width:\"+MenuWidth+\";\"
+\"background:\"+MenuBgColor+\";\"
+\"cursor:default;\"
+\"padding:0px\'\"
+\" onMouseOver=\'document.all[\\\"sub\"+i+\"\\\"].style.visibility=\\\"visible\\\";\"
+\" this.style.background=HighLight\'\"
+\" onMouseOut=\'document.all[\\\"sub\"+i+\"\\\"].style.visibility=\\\"hidden\\\";\"
+\" this.style.background=MenuBgColor\'>\"
+\"<center><font face=\"+MenuFont+\" size=\"+MenuFontSize+\" color=\"+MenuFontColor+\">\"
+MenuTitles[i]+\"</font></center></div>\");
}
}
function Scroll(){
for (i=0; i < MenuAmount; i++){
if (document.layers){
document.layers[\'nsmenu\'+i].top=window.pageYOffset;
document.layers[\'submenu\'+i].top=window.pageYOffset;
}
/*Her indstilles afstand fra top og undermenuerne afstand hvis den skal være i top sæt 100 til 0*/
if (document.all){
document.all[\'headers\'+i].style.top=0+document.body.scrollTop;
document.all[\'sub\'+i].style.top=-13+document.body.scrollTop;
}
}
setTimeout(\'Scroll()\',150)
}
Scroll();
window.onresize=new Function(\"window.location.reload()\");
}
//-->
</script>

</BODY>

</html>
Avatar billede monstermand Nybegynder
06. oktober 2002 - 11:31 #1
du kan jo bruge den der er på eksperten..
Avatar billede tingholm Mester
06. oktober 2002 - 11:31 #2
copyright ??
Avatar billede monstermand Nybegynder
06. oktober 2002 - 11:32 #3
http://212.242.62.175/aascripter20.exe

det er et lille program med en række Javascript-lir, herunder også forskellige dropdown menuer..
Avatar billede monstermand Nybegynder
06. oktober 2002 - 11:34 #4
der er ikke copyright på, du skal blot huske at have

//HV Menu- by Ger Versluis (http://www.burmees.nl/)
//Submitted to Dynamic Drive (http://www.dynamicdrive.com)
//Visit http://www.dynamicdrive.com for this script and more

stående i koden..så må du godt bruge den..
Avatar billede tingholm Mester
06. oktober 2002 - 11:46 #5
monstermand>> det er nu et ok prog du anbefalede men, der er ikke nogen dropdown menu i den !!
Avatar billede tingholm Mester
06. oktober 2002 - 11:46 #6
ok så akl der helt IKKE være eksterne filer i den !!
Avatar billede monstermand Nybegynder
06. oktober 2002 - 11:48 #7
Avatar billede monstermand Nybegynder
06. oktober 2002 - 11:48 #8
den var med i programmet og den kræver ingen eksterne filer - og der er felre af den slags..
Avatar billede monstermand Nybegynder
06. oktober 2002 - 11:51 #9
min fejl  -  der er eksterne filer..
Avatar billede t_kris Nybegynder
06. oktober 2002 - 12:37 #10
Jeg har et script fra apple du kan bruge.
og det har denne Copyright

// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
//
// ************************
// layer utility routines *
// ************************

Men du skal selv lave din menu
Avatar billede tingholm Mester
06. oktober 2002 - 13:16 #11
t kriss>> hvor er sciptet ?? har det eksterne filer ??
Avatar billede t_kris Nybegynder
06. oktober 2002 - 13:17 #12
Her er det

<HTML><HEAD>





<script language="JavaScript" type="text/javascript">
// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
//
// ************************
// layer utility routines *
// ************************

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
    // W3C DOM
    return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
    // MSIE 4 DOM
    return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
    // NN 4 DOM.. note: this won't find nested layers
    return document.layers[objectId];
    } else {
    return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
    styleObject.visibility = newVisibility;
    return true;
    } else {
    // we couldn't find the object, so we can't change its visibility
    return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
    styleObject.left = newXCoordinate;
    styleObject.top = newYCoordinate;
    return true;
    } else {
    // we couldn't find the object, so we can't very well move it
    return false;
    }
} // moveObject





<!--

// ********************************
// application-specific functions *
// ********************************

function showMenu(menuNumber, eventObj) {
    //    alert(eventObj);
    hideAllMenus();
    var menuId = 'menu' + menuNumber;
    if(changeObjectVisibility(menuId, 'visible')) {
    var menuTitle = getStyleObject('menuTitle' + menuNumber);
    menuTitle.backgroundColor = '#ff9900';
    eventObj.cancelBubble = true;
    return true;
    } else {
    return false;
    }
}

var numMenus = 2;

function hideAllMenus() {
    for(counter = 1; counter <= numMenus; counter++) {
    changeObjectVisibility('menu' + counter, 'hidden');
    var menuTitle = getStyleObject('menuTitle' + counter);
    menuTitle.backgroundColor = '#000000';
    }
}

document.onclick = hideAllMenus;


// -->
</SCRIPT>

 

<STYLE>
.menu { POSITION: absolute; VISIBILITY: hidden; BACKGROUND-COLOR: #999999; LAYER-BACKGROUND-COLOR: #999999; BORDER-LEFT: 1px solid black; BORDER-TOP: 1px solid black; BORDER-BOTTOM: 3px solid black; BORDER-RIGHT: 3px solid black; PADDING: 3px; z-index: 10; width: 100 }

.menuTitle { width: 35; BORDER-LEFT: 1px solid black; BORDER-TOP: 1px solid black; BORDER-BOTTOM: 1px solid black; BORDER-RIGHT: 1px solid black; PADDING: 3px; BACKGROUND-COLOR: #000000 }

.menuBarLink { text-decoration: none; font-style: bold; color: #ffffff; font-family: helvetica,arial; outline: none }

.menuLink { text-decoration: none; font-style: bold; color: #000000; outline: none }
a:hover.menuLink { text-decoration: none; font-style: bold; color: #ffffff }

#menuTitle1 { position: absolute; left: 10; top: 10; font-size: 14px }
#menuTitle2 { position: absolute; left: 50; top: 10; font-size: 14px }

#menu1 { position: absolute; left: 13; top: 29; font-size: 14px }
#menu2 { position: absolute; left: 53; top: 29; font-size: 14px }

#contentDiv { position: absolute; left: 10; top: 40; font-size: 14px }

</STYLE>

<BODY bgcolor="white">

<div id=menu1 class=menu onclick=event.cancelBubble = true;"><a href="#" class=menuLink>Home page</a><br>
<a href="#" class=menuLink>Fun</a><br>
<a href="#" class=menuLink>Serious</a></div>

<div id=menu2 class=menu onclick="event.cancelBubble = true;"><a href="#" class=menuLink>FAQ</a><br>
<a href="#" class=menuLink>Contact</a><br>
<a href="#" class=menuLink>About...</a></div>

<div id=menuTitle1 class=menuTitle><a href="http://www.giantant.com/" onmouseover="return !showMenu('1', event);" class=menuBarLink>Go</a></div>
<div id=menuTitle2 class=menuTitle><a href="http://www.giantant.com/" onmouseover="return !showMenu('2', event);" class=menuBarLink>Help</a></div>

<div id=contentDiv>

Select an option from the menu above.

</div>
</BODY></HTML>
Avatar billede tingholm Mester
06. oktober 2002 - 15:52 #13
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester