View Full Version : Help with Menu script

12-25-2003, 03:49 PM
I have purchased a JS and am teaching myself atm. There is a menu script shown to help you understand features which i am replicating into my web atm. The menu works by when the mouse is placed over the Menu 1 is will bring up a layer below it with links on and when the mouse it is moved away is disappears and so on.

I cannot get it to work.

This URL is what i have produced with script : http://www.araw93.dsl.pipex.com/main.htm

This is the scripting i have :

<Script Type= "text/JS">
document.onmousemove = track;
divref = (document.all) ? "" : "document.";
stlref = (document.all) ? "style." : "";

function track(e){
var x = (document.all) ? event.x : e.pageX;
var y = (document.all) ? event.y : e.pageY;
if ( x<1 || x>65 || y<53 || y>123 )
eval( divref + "b." + stlref + "visibility = 'hidden'");
if ( x<80 || x>145 || y<53 || y>123 )
eval( divref + "c." + stlref + "visibility = 'hidden'");
if ( x<160 || x>225 || y<53 || y>123 )
eval( divref + "d." + stlref + "visibility = 'hidden'");

function reveal(menu){
eval( divref + menu + "." + stlref + "visibility =
'visible'"); }

This is the html to thats link all the stuff together:

<DIV ID = "a" CLASS = "bar">
<A HREF="javascript://" ONMOUSEOVER="reveal('b')">&nbsp;
Menu 1</A> |
<A HREF="javascript://" ONMOUSEOVER="reveal('c')">&nbsp;
Menu 2</A> &nbsp; |
<A HREF="javascript://" ONMOUSEOVER="reveal('d')">&nbsp;
Menu 3</A> &nbsp; |

<DIV ID= "b" CLASS = "menu" Style = "left:0" LEFT = "0">
<A HREF = "target1.htm"> Item 1 </A>
<A HREF = "target2.htm"> Item 2 </A>
<A HREF = "target3.htm"> Item 3 </A></DIV>

<DIV ID= "c" CLASS = "menu" Style = "left:80" LEFT = "80">
<A HREF = "target4.htm"> Item 1 </A>
<A HREF = "target5.htm"> Item 2 </A>
<A HREF = "target6.htm"> Item 3 </A></DIV>

<DIV ID= "d" CLASS = "menu" Style = "left:160" LEFT = "160">
<A HREF="target7.htm"> Item 1 </A>
<A HREF="target8.htm"> Item 2 </A>
<A HREF="target9.htm"> Item 3 </A></DIV>

Could someone help me point out wheres its gone wrong and how to correct it so i can make it do what it should?

I have set the properties of the dropdown menu and menu bar seperate and there is nothing wrong their.

These are not important but would know if possible:

1. Can the silver nemu bar part be made so that it will always be the length on the page? IE it will be different for people who have maximised/minmised windows and different resolutions.

2. Is there some code that can center the Menu1, Menu 2 etc can be cnetered on the silver bar or would the co-ordinates have to be changed for that?

Any help would be appreciated!

Merry X-mass too.