Avatar billede Slettet bruger
14. september 2001 - 23:27 Der er 6 kommentarer og
1 løsning

centering af menu system

Jeg har dette menu system. men jeg vil gerne centrere menuen. det jeg kan hitte ud af er at jeg kan sætte hvorlangt fra ventre side at menuen skal starte,

script:

<script language=\"JavaScript1.2\" type=\"text/javascript\">
/*****************************************************************************
Default browsercheck
******************************************************************************/
function checkBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf(\"MSIE 5\")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.opera=!(this.ie5 || this.ie4 || this.ns4 || this.ns5) && this.dom
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
var bw=new checkBrowser()
</script>

<script language=\"JavaScript1.2\" src=\"coolframe.js\" type=\"text/javascript\"></script>
    <base target=\"_self\">
</head>
<body bgcolor=\"#000066\" topmargin=\"2\" leftmargin=\"2\">
<script language=\"JavaScript1.2\" type=\"text/javascript\">
/*****************************************************************************
Main variables
******************************************************************************/
mDebugging=1 //Set to 0 for NO Debugging, set to 1 for alert debugging and set to 2 for status.

oCFMenu=new coolFrameMenu(\'oCFMenu\') //Making a new menu

oCFMenu.menuFrameName=\"frmMain\" //The name of your \"main\" frame
oCFMenu.startPage=\"startside.asp\" //The first page to appear in the main frame (it\'s important that this is loaded after the menu is created!)
oCFMenu.maxsubs=7 //The max number of subs you will have
oCFMenu.maxsubs2=7 //The max number of sub2s you will have
oCFMenu.maxsubs3=7 //The max number of sub2s you will have

//Frametype:
// 0 = menu in left frame
// 1 = menu in right frame
// 2 = menu in top frame
// 3 = menu in bottom frame
oCFMenu.frametype=2
//NOTE: If your using 1 or 3 and expect to have scrollbars remember to set the subXplacement and subYplacement to suit the scrollbars.
//I was going to add an automatic check of that, but then I would have had to add more code in the main pages (a onload function)
//And I didn\'t want to do that

oCFMenu.pagecheck=1 //This is a check that will keep the submenus from going to far out! Only for top and bottom frame

oCFMenu.mainheight=25 //The height of the main menuitems in pixel or %
oCFMenu.mainwidth=130 //The width of the main menuitems  in pixel or %

oCFMenu.subwidth=180 //  The width of the submenus
oCFMenu.subheight=25 //The height if the subitems in pixel or %

oCFMenu.sub2width=oCFMenu.mainwidth // The width of the sub2menus in pixel or %
oCFMenu.sub2height=oCFMenu.subheight // The height if the sub2items in pixel or %

oCFMenu.sub3width=oCFMenu.mainwidth // The width of the sub3menus in pixel or %
oCFMenu.sub3height=oCFMenu.subheight // The height if the sub3items in pixel or %

oCFMenu.subXplacement=0 // Relative to the main item
oCFMenu.subYplacement=0 // Relative to the main item

oCFMenu.sub2Xplacement=oCFMenu.subwidth-30 // The X placement of the subsubmenus, relative to the sub item
oCFMenu.sub2Yplacement=5 // The Y placement of the subsubmenus, relative to the sub item

oCFMenu.sub3Xplacement=oCFMenu.sub2width-30 // The X placement of the subsubmenus, relative to the sub2 item
oCFMenu.sub3Yplacement=5 // The Y placement of the subsubmenus, relative to the sub2 item

oCFMenu.mainbgcoloroff=\'#000066\' //The backgroundcolor of the main menuitems
oCFMenu.mainbgcoloron=\'#000066\' //The backgroundcolor on mouseover of the main menuitems
oCFMenu.maintextcolor=\"#FFFF00\" //The original text color
oCFMenu.mainhovercolor=\"red\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

oCFMenu.subbgcoloroff=\'#000066\' //The backgroundcolor of the sub menuitems
oCFMenu.subbgcoloron=\'#000066\' //The backgroundcolor on mouseover of the sub menuitems
oCFMenu.subtextcolor=\"#FFFF00\" //The original text color
oCFMenu.subhovercolor=\"red\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

oCFMenu.sub2bgcoloroff=\'#000066\' //The backgroundcolor of the subsub menuitems
oCFMenu.sub2bgcoloron=\'#000066\' //The backgroundcolor on mouseover of the subsub menuitems
oCFMenu.sub2textcolor=\"#FFFF00\" //The original text color
oCFMenu.sub2hovercolor=\"red\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

oCFMenu.sub3bgcoloroff=\'#000066\' //The backgroundcolor of the subsub menuitems
oCFMenu.sub3bgcoloron=\'#000066\' //The backgroundcolor on mouseover of the subsub menuitems
oCFMenu.sub3textcolor=\"#FFFF00\" //The original text color
oCFMenu.sub3hovercolor=\"red\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

//Borders
oCFMenu.bordersize=1
oCFMenu.bordercolor=\"#000066\"
//NOTE: The border immplemtation isn\'t prefect. The width and placement of elements have nothing
//to say here, so play with the fromtop, fromleft, subXplacement et cetera to get the desired effect.

//Styles for the top menus! - Change the colors, padding and other styles in here!
oCFMenu.topstyle=\"font-family:Verdana; font-size:13px; padding:4px;\"
//Styles for the submenus - Change the colors, padding and other styles in here!
oCFMenu.substyle=\"padding:3px; font-family:Verdana; font-size:12px\"
//Styles for the sub2menus - Change the colors, padding and other styles in here!
oCFMenu.sub2style=\"padding:3px; font-family:Verdana; font-size:12px\"
//Styles for the sub3menus - Change the colors, padding and other styles in here!
oCFMenu.sub3style=\"padding:3px; font-family:Verdana; font-size:11px\"

//LEAVE THESE LINES
oCFMenu.makeStyle() //Writes out the style for the top menus
oCFMenu.makeFrameString() //Makes the string for the main frame


//Placement of the menuitems

//Example in %:
//oCFMenu.menuplacement=new Array(\"0%\",\"30%\",\"45%\",\"60%\",\"75%\",\"90%\") //Remember to make the arrays contain as many values as you have main menuitems

//Example in px: (remember to use the \' \' around the numbers)
//oCFMenu.menuplacement=new Array(10,200,300,400,500,600,700)

//Example right beside eachother (only adding the pxbetween variable)
oCFMenu.menuplacement=

//If you use the \"right beside eachother\" you cant how many pixel there should be between each here
oCFMenu.pxbetween=0 //in pixel or %

//And you can set where it should start from the left here
oCFMenu.fromleft=\"10%,90%\" //in pixel or %

//This is how much from the top the menu should be.
oCFMenu.fromtop=15 //in pixel or %


//Making a top element makeTop(TEXT,LINK,TARGET,WIDTH,FUNCTION)
//TEXT = the text that you want displayed inside the item
//LINK = The page you want the item to link to - Set to 0 or don\'t spesify if you don\'t want a link
//TARGET = The target for the link, set to _blank, frame_name, _top - Set to 0 or don\'t spesify if you don\'t want a target
//WIDTH = Here you can set an individual width for each top element. This is ONLY availble on the top elements
//FUNCTION = If you want some Javascript code to be executed when this item is clicked place it here

oCFMenu.makeTop(\'<b>Startside</b>\',\'startside.asp\',\'frmMain\',75) //Main 1

oCFMenu.makeTop(\'<b>Ajour</b>\',0,0,53) //Main 5
    oCFMenu.makeSub(\'Forbundsrådets spalte\',\'../nyhed/nyheder.asp\',\'frmMain\')
    oCFMenu.makeSub(\'Rapporter/bedebreve\',\'brevetekst.asp\',\'frmMain\')
    oCFMenu.makeSub(\'Debatforum\',\'../forum/default.asp\',\'frmMain\')
   
oCFMenu.makeTop(\'<b>Kontakt</b>\',0,0,65) //Main 7
    oCFMenu.makeSub(\'Servicecenter\',\'email.asp\',\'frmMain\')
    oCFMenu.makeSub(\'Morgenstjernens redaktion\',\'email.asp\',\'frmMain\')
    oCFMenu.makeSub(\'DDM\',\'email.asp\',\'frmMain\')   
    oCFMenu.makeSub(\'Web-master\',\'email.asp\',\'frmMain\')

oCFMenu.makeTop(\'<b>Oplysniger</b>\',0,0,97) //MAIN 2
oCFMenu.makeSub(\'Adressebogen\',\'../kontakt/navneliste.asp\',\'frmMain\')
oCFMenu.makeSub(\'Kalender\',\'../events/events.asp\',\'frmMain\')
oCFMenu.makeSub(\'Årsrapport\',\'../arsrapport/arsrapport.asp\',\'frmMain\')
oCFMenu.makeSub(\'Synode\',\'synodetekst.asp\',\'frmMain\')
oCFMenu.makeSub(\'Mellemkirkelige relationer\',\'../mellemkirkelig.asp\',\'frmMain\')
       
   
oCFMenu.makeTop(\'<b>Adm. og Økonomi</b>\',0,0,150) //Main 3
    oCFMenu.makeSub(\'Årsbudget\',\'budget.pdf\',\'_blank\')   
  oCFMenu.makeSub(\'Årsregnskab\',\'regnskab.asp\',\'frmMain\')
  oCFMenu.makeSub(\'Testamente\',\'testamente.asp\',\'frmMain\')
  oCFMenu.makeSub(\'Ansættelsesaftale\',\'ansættelsesaftale.doc\',\'_blank\')
  oCFMenu.makeSub(\'Attester/Beviser\',\'bevis.doc\',\'_blank\')

 
oCFMenu.makeTop(\'<b>Love og vedtægter</b>\',0,0,150) //Main 4
    oCFMenu.makeSub(\'Vejledende vedtægter\',\'vejledende.pdf\',\'_blank\')
    oCFMenu.makeSub(\'DDM´s love og vedtægter\',\'love.pdf\',\'_blank\')   
    oCFMenu.makeSub(\'Ordination og indsættelse\',\'ordination.pdf\',\'_blank\')   
    oCFMenu.makeSub(\'Øresunds vedtægter\',\'oresund.pdf\',\'_blank\')
    oCFMenu.makeSub(\'Skolepolitik\',\'skolepolitik.asp\',\'frmMain\')
       
oCFMenu.makeTop(\'<b>DDMnet</b>\',0,0,60) //Main 6
    oCFMenu.makeSub(\'Undervisning\',\'http://www.salt-akademi.dk/\',\'_blank\')   
    oCFMenu.makeSub(\'Arrangementer\',\'arrangement.asp\',\'frmMain\')
    oCFMenu.makeSub(\'Hjemmeside\',\'hjemmeside.asp\',\'frmMain\')
    oCFMenu.makeSub(\'Søgeside\',\'site_search_medlem.asp\',\'frmMain\')
   
   
//Leave these lines!
oCFMenu.construct()

//Setting the bottom page. This have to be done so that we are sure that the menus are built
//before we load the bottom page. If the page was resized we want to load the same page back into the frameset
searchtext=location.search
isresized=searchtext.lastIndexOf(\"resizedurl\")
if(isresized>-1){ //Get PAGE
    oCFMenu.startPage=\"http://\" + searchtext.substr(isresized+11,searchtext.length)
}
if(top[oCFMenu.menuFrameName])top[oCFMenu.menuFrameName].location.href=oCFMenu.startPage
</script>
Avatar billede roenving Novice
15. september 2001 - 01:06 #1
Centrere hvordan?

Jeg har ik\' li\'e lyst til at opbygge en homepage for at teste (den i øvrigt ganske udmærkede menu), men der nogle styles, det er måske der, du kan sætte noget mere ind, som centrerer:

//Styles for the top menus! - Change the colors, padding and other styles in here!
oCFMenu.topstyle=\"font-family:Verdana; font-size:13px; padding:4px;\"
//Styles for the submenus - Change the colors, padding and other styles in here!
oCFMenu.substyle=\"padding:3px; font-family:Verdana; font-size:12px\"
//Styles for the sub2menus - Change the colors, padding and other styles in here!
oCFMenu.sub2style=\"padding:3px; font-family:Verdana; font-size:12px\"
//Styles for the sub3menus - Change the colors, padding and other styles in here!
oCFMenu.sub3style=\"padding:3px; font-family:Verdana; font-size:11px\"

Det du skal sætte ind, vil så være \'text-align:center\'

hth
jes
Avatar billede Slettet bruger
15. september 2001 - 02:57 #2
det er kun selve teksten der bliver center, de er menigen at selve menuen skal center.
Avatar billede roenving Novice
15. september 2001 - 02:59 #3
Centrere hvordan??
Avatar billede roenving Novice
15. september 2001 - 03:04 #4
Hvad skal den centreres over ?
Er det en tabel, den er inde i, ja, jeg tror det ikke, for den måde menuen er opbygget på er ikke tabeller.

Nå, men mit gæt er, at du vil centrere dem inde i et bestemt element (en frame?), så med en menu-opbygning du har der, bliver det næsten umuligt (en meget lang længde af beregninger og ændring af selve grundlaget for menuens opbygning !·] ).

Prøv lige at kigge på nogle af de andre dynamiske menuer, f.eks. www.dhtmlcentral.com --> Coolmenus

hth
jes
Avatar billede Slettet bruger
15. september 2001 - 13:07 #5
Det var ærgeligt!
Skal man / du have point for det!
Avatar billede Slettet bruger
18. september 2001 - 02:09 #6
:)
Avatar billede roenving Novice
18. september 2001 - 03:06 #7
;-[
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