PDA

View Full Version : DHTML


The Laughing Cow
18-01-2001, 20:06
hi, i use a script similar to the gameplay one above with the drop down menu.


<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>New Page 1</title>

<script language="JavaScript" src="navcond.js"></script>
<script language="JavaScript">



var myNavBar1 = new NavBar(0);
var dhtmlMenu;


dhtmlMenu = new NavBarMenu(100, 0);
dhtmlMenu.addItem(new NavBarMenuItem("Home", "index.shtml"));
myNavBar1.addMenu(dhtmlMenu);

dhtmlMenu = new NavBarMenu(100, 120);
dhtmlMenu.addItem(new NavBarMenuItem("Services", ""));
dhtmlMenu.addItem(new NavBarMenuItem("Hosting", "hosting.shtml"));
dhtmlMenu.addItem(new NavBarMenuItem("Web Page Design", "design.shtml"));
myNavBar1.addMenu(dhtmlMenu);

dhtmlMenu = new NavBarMenu(110, 120);
dhtmlMenu.addItem(new NavBarMenuItem("Portfolio", ""));
dhtmlMenu.addItem(new NavBarMenuItem("Broken Windows", "index.shtml"));
dhtmlMenu.addItem(new NavBarMenuItem("CES Alarms", "index.shtml"));
//dhtmlMenu.addItem(new NavBarMenuItem("Other", "index.shtml"));
//dhtmlMenu.addItem(new NavBarMenuItem("Other", "index.shtml"));
myNavBar1.addMenu(dhtmlMenu);

dhtmlMenu = new NavBarMenu(100, 150);
dhtmlMenu.addItem(new NavBarMenuItem("Windy", ""));
dhtmlMenu.addItem(new NavBarMenuItem("Team", "team.shtml"));
dhtmlMenu.addItem(new NavBarMenuItem("Jobs", "jobs.shtml"));
dhtmlMenu.addItem(new NavBarMenuItem("Admin", "admin.shtml"));
dhtmlMenu.addItem(new NavBarMenuItem("Contact", "contact.shtml"));
myNavBar1.addMenu(dhtmlMenu);

//dhtmlMenu = new NavBarMenu(100, 150);
//dhtmlMenu.addItem(new NavBarMenuItem("TBA", ""));
//dhtmlMenu.addItem(new NavBarMenuItem("TBA", "index.shtml"));
//dhtmlMenu.addItem(new NavBarMenuItem("TBA", "index.shtml"));
//dhtmlMenu.addItem(new NavBarMenuItem("TBA", "index.shtml"));
//dhtmlMenu.addItem(new NavBarMenuItem("TBA", "index.shtml"));
//myNavBar1.addMenu(dhtmlMenu);

//set menu colors
myNavBar1.setColors("#000066", "#ffffff", "#000066", "#ffffff", "#6600cc", "#ffffff", "#6699ff", "#ffffff", "#6600cc")

//uncomment below line to center the menu (valid values are "left", "center", and "right"
myNavBar1.setAlign("center")

var fullWidth;

function init() {



fullWidth = getWindowWidth()
- (isMinNS4 && getWindowHeight() < getPageHeight() ? 16 : 0);

myNavBar1.moveTo(0,0)
myNavBar1.create();
myNavBar1.setzIndex(2);
}
</script>

</head>

<body onload="init()" bgcolor="#FFFFFF">

</body>

</html>


I then incorporate this page into all my other pages with a SSI. How can i get the menu to be in the middle of the page?


i assume its this line here

myNavBar1.moveTo(0,0)

i change the X component so its ok at 1024 but at 800*600 its off to the right. Any ideas?

Watermelon
18-01-2001, 20:32
couldn't you put it in % some how ?

just an idea :)

Waldo
18-01-2001, 21:40
//uncomment below line to center the menu (valid values are "left", "center", and "right"
myNavBar1.setAlign("center")

???
Is that not what this function does?

The Laughing Cow
18-01-2001, 22:04
thats the thing- it doesnt :confused:

[OAP}SAGA Lout
18-01-2001, 22:23
Well, I havent touched programming for 10 years and dont know Javascript and there is probably a really easy way to do it....but....

fullWidth = getWindowWidth()

Can you not use this variable to determine screen size then use maths to calculate centre?

eg. if windowwidth is 800 and nav bar is 500 then to find the X amount to centre it would be

X=(windowwidth-Navbar)/2

ie 150 in the above example.

This may be total bollox but it was good to exercise me brain matter :)

Apologies if this was no help whatsoever.