PDA

View Full Version : help with navigation menu


mex
02-15-2004, 06:12 AM
Can anyone rewrite this script so that the LINK be placed in .js file and the other part of the script be placed in a .html file! The main reason behind is that I dont have to go to every page while putting up a new link! but just updating the .js file....Hope u understand what i mean. Thanx

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
<TITLE>JavaScript Popup Menu by Mike McGrath</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">

<STYLE type=text/css>
<!--
.lilguydiv {left:100px; width:30px; position:absolute; top:100px; height:21px}
.menudiv {border:red 2px solid; z-index:10; left:60px; visibility: hidden;
font-size:10pt; width:160px; position:absolute; top:80px; height:106px; background-color:white}

//-->
</STYLE>

</HEAD>

<BODY>Run your pointer over this little guy to get a menu ...

<DIV class=lilguydiv>
<A onmouseover=menu(1) href="javascript:\\">
<IMG height="48" src="images/lilguy1.gif" width="58" border=0></A></DIV>

<DIV class=menudiv id="linkmenu">
<CENTER><B>Select A Link</B></CENTER>
<UL><A href="javascript:fakelocation(1)">
<LI>Link One</A> <A href="javascript:fakelocation(2)">
<LI>Link Two</A> <A href="javascript:fakelocation(3)">
<LI>Link Three</A> </LI></UL></DIV>

<SCRIPT type=text/javascript>
<!-- Original: Mike McGrath (mike_mcgrath@lineone.net) -->
<!-- Website : http://website.lineone.net/~mike_mcgrath -->
<!--

var nav=(document.layers);
var n_6=(window.sidebar);
if(nav)document.captureEvents(Event.MOUSEMOVE);
if(n_6) document.addEventListener("mousemove",track,true);
document.onmousemove=track;

function track(e)
{
var x=(nav||n_6)?e.pageX:event.x;
var y=(nav||n_6)?e.pageY:event.y;
x=parseInt(x);
y=parseInt(y);
isvis(x,y);
}

function isvis(x,y)
{
if(nav)
{
if(document.linkmenu.visibility!="hide")
{
if(x<60||x>220||y<80||y>166)document.linkmenu.visibility="hide";
}
}
else if(n_6)
{
if(document.getElementById("linkmenu").style.visibility!="hidden")
{
if(x<60||x>220||y<80||y>186)document.getElementById("linkmenu").style.visibility="hidden";
}
}
else if(linkmenu.style.visibility!="hidden")
{
if(x<60||x>220||y<80||y>186)linkmenu.style.visibility="hidden";
}
}

function menu(n)
{
if(nav)
{
document.linkmenu.visibility=(n!=0)?"visible":"hidden";
}
else if(n_6)
{
document.getElementById("linkmenu").style.visibility=(n!=0)?"visible":"hidden";
}
else linkmenu.style.visibility=(n!=0)?"visible":"hidden";
}

function fakelocation(n)
{
alert("This is target "+n+" ......\nreplace this link with your target URL");
}

// -->
</SCRIPT>
</BODY></HTML>

Vladdy
02-15-2004, 01:43 PM
Originally posted by mex
Can anyone rewrite this script so that the LINK be placed in .js file and the other part of the script be placed in a .html file! The main reason behind is that I dont have to go to every page while putting up a new link!
<snip />
If you tell me how those without JS will navigate your page :rolleyes:

mex
02-15-2004, 02:47 PM
well.....using the html page!!!! The html page should be link to the js file which contains the various links!!!

I mean to place the links in the .JS file so that it can be view in a html page.....by linking the html page wiht the js file....