Phoenixv:
Nu har jeg lavet en menu, men hvordan centrere jeg den, altså så den står midt i browseren ???
Her er mit Script:
<script language=\"JavaScript\" src=\"navcond.js\"></script>
<script language=\"JavaScript\">
var myNavBar1 = new NavBar(0);
var dhtmlMenu;
//define menu items (first parameter of NavBarMenu specifies main category width, second specifies sub category width in pixels)
//add more menus simply by adding more \"blocks\" of same code below
dhtmlMenu = new NavBarMenu(100, 0);
dhtmlMenu.addItem(new NavBarMenuItem(\"Home\", \"index.html\"));
myNavBar1.addMenu(dhtmlMenu);
dhtmlMenu = new NavBarMenu(100, 120);
dhtmlMenu.addItem(new NavBarMenuItem(\"Product\", \"\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"TopScore 700\", \"products/ts700.html\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"TopScore 500\", \"products/ts500.html\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Loc\", \"products/loc.html\"));
myNavBar1.addMenu(dhtmlMenu);
dhtmlMenu = new NavBarMenu(110, 120);
dhtmlMenu.addItem(new NavBarMenuItem(\"Service\", \"\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"News.com\", \"
http://www.news.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Techweb\", \"
http://www.techweb.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Wired\", \"
http://www.wired.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Dynamic Drive\", \"
http://www.dynamicdrive.com\"));
myNavBar1.addMenu(dhtmlMenu);
dhtmlMenu = new NavBarMenu(150, 150);
dhtmlMenu.addItem(new NavBarMenuItem(\"About DeskPro\", \"\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Yahoo\", \"
http://www.yahoo.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Alta Vista\", \"
http://www.altavista.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Infoseek\", \"
http://www.infoseek.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Excite\", \"
http://www.excite.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"HotBot\", \"
http://www.hotbot.com\"));
myNavBar1.addMenu(dhtmlMenu);
dhtmlMenu = new NavBarMenu(100, 150);
dhtmlMenu.addItem(new NavBarMenuItem(\"Contact\", \"\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Dynamic Drive\", \"
http://dynamicdrive.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Website Abstraction\", \"
http://wsabstract.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Freewarejava.com\", \"
http://freewarejava.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"BrainJar\", \"
http://brainjar.com\"));
myNavBar1.addMenu(dhtmlMenu);
dhtmlMenu = new NavBarMenu(150, 150);
dhtmlMenu.addItem(new NavBarMenuItem(\"Where to find?\", \"\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Dynamic Drive\", \"
http://dynamicdrive.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Website Abstraction\", \"
http://wsabstract.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"Freewarejava.com\", \"
http://freewarejava.com\"));
dhtmlMenu.addItem(new NavBarMenuItem(\"BrainJar\", \"
http://brainjar.com\"));
myNavBar1.addMenu(dhtmlMenu);
//set menu colors
myNavBar1.setColors(\"#000000\", \"#FFFFFF\", \"#000000\", \"#FFFFFF\", \"#000080\", \"#FFFFFF\", \"#000000\", \"#FFFFFF\", \"#000080\")
//uncomment below line to center the menu (valid values are \"left\", \"center\", and \"right\"
//myNavBar1.setAlign(\"center\")
var fullWidth;
function init() {
// Get width of window, need to account for scrollbar width in Netscape.
fullWidth = getWindowWidth()
- (isMinNS4 && getWindowHeight() < getPageHeight() ? 16 : 0);
myNavBar1.resize;
myNavBar1.create();
myNavBar1.setzIndex(2);
}
</script>