J
Jarry
I'm very new to javascipt, and I was copying this text out a book, but
it doesn't seem to be working. Any ideas (its probably a syntax error)?
Thank anyway!
<SCRIPT TYPE = "text/javascript">
<!--
if(document.layers)document.captureEvents(Event.MOUSEMOVE) ;
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'" ); }
//-->
</SCRIPT>
<STYLE TYPE = "text/css">
<!--
..bar{ position:absolute; left:0; top:50; color:black; width:800;
height:20px; background:silver; font-family:verdana; font-size:10pt;
border-color:white; border-width:1; }
..menu { position:absolute; width:65; height:50; background:silver;
top:71px; visibility:hidden; font-family:verdana; font-size:10pt;
border-color:white; border-width:1px; }
//-->
</STYLE>
<DIV ID= "a" CLASS= "bar">
<A HREF = "javascript://" ONMOUSEOVER="reveal('b')"> Menu 1</A> |
<A HREF = "javascript://" ONMOUSEOVER="reveal('c')"> Menu 2</A> |
<A HREF = "javascript://" ONMOUSEOVER="reveal('d')"> Menu 3</A> |
</DIV>
<DIV ID = "b" CLASS= "menu" STYLE= "left:0" LEFT= "0">
<A HREF "target1.html"> Item 1 </A>
<A HREF "target2.html"> Item 2 </A>
<A HREF "target3.html"> Item 3 </A> </DIV>
<DIV ID = "b" CLASS= "menu" STYLE= "left:0" LEFT= "0">
<A HREF "target4.html"> Item 1 </A>
<A HREF "target5.html"> Item 2 </A>
<A HREF "target6.html"> Item 3 </A> </DIV>
<DIV ID = "b" CLASS= "menu" STYLE= "left:0" LEFT= "0">
<A HREF "target7.html"> Item 1 </A>
<A HREF "target8.html"> Item 2 </A>
<A HREF "target9.html"> Item 3 </A> </DIV>
it doesn't seem to be working. Any ideas (its probably a syntax error)?
Thank anyway!
<SCRIPT TYPE = "text/javascript">
<!--
if(document.layers)document.captureEvents(Event.MOUSEMOVE) ;
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'" ); }
//-->
</SCRIPT>
<STYLE TYPE = "text/css">
<!--
..bar{ position:absolute; left:0; top:50; color:black; width:800;
height:20px; background:silver; font-family:verdana; font-size:10pt;
border-color:white; border-width:1; }
..menu { position:absolute; width:65; height:50; background:silver;
top:71px; visibility:hidden; font-family:verdana; font-size:10pt;
border-color:white; border-width:1px; }
//-->
</STYLE>
<DIV ID= "a" CLASS= "bar">
<A HREF = "javascript://" ONMOUSEOVER="reveal('b')"> Menu 1</A> |
<A HREF = "javascript://" ONMOUSEOVER="reveal('c')"> Menu 2</A> |
<A HREF = "javascript://" ONMOUSEOVER="reveal('d')"> Menu 3</A> |
</DIV>
<DIV ID = "b" CLASS= "menu" STYLE= "left:0" LEFT= "0">
<A HREF "target1.html"> Item 1 </A>
<A HREF "target2.html"> Item 2 </A>
<A HREF "target3.html"> Item 3 </A> </DIV>
<DIV ID = "b" CLASS= "menu" STYLE= "left:0" LEFT= "0">
<A HREF "target4.html"> Item 1 </A>
<A HREF "target5.html"> Item 2 </A>
<A HREF "target6.html"> Item 3 </A> </DIV>
<DIV ID = "b" CLASS= "menu" STYLE= "left:0" LEFT= "0">
<A HREF "target7.html"> Item 1 </A>
<A HREF "target8.html"> Item 2 </A>
<A HREF "target9.html"> Item 3 </A> </DIV>