Remember The Microsoft Script..........
Hey what's up guys? Well, I don't know if you remember but, I once posted a question about a script that was seen at the microsoft site. Well, the script was that when you moved your mouse over a link, a box would appear with more links. I saw that no one could figure it out. Well, I just did. If this script has been revlealed, I'm making a fool out of myself. If no one has revealed, great. To start, this was a script with when you clicked the link, the box would appear. Well, I went around and played with it and finally got the mouseover to work. Here is how to do it. *No need to download anything.*
/********************************************************************
Below this, you an edit the bg color, color of the links, and so forth.
**********************************************************************
<style>
A:hover{color:red}
#divBg{position:absolute; top:0; left:0; visibility:hidden; height:50}
DIV.clSub{position:relative; top:-5; font-family:arial,helvetica; font-size:12px; padding:10px; visibility:hidden; background-color:black; layer-background-color:background color choice!!}
</style>
<script language="JavaScript1.2">
/********************************************************************************
Copyright (C) 1999 John Flores
********************************************************************************
Browsercheck:*/
ie=document.all?1:0
n=document.layers?1:0
//Do you want it to move with the page if the user scroll the page?
var moveOnScroll=true
//Do you want to hide all the other submenus when you click a new?
var hideAll=true
/********************************************************************************
If you want to change the appearans on the text, or background or anything
do that in the style tag above, or in the table tag below.
********************************************************************************/
/********************************************************************************
Object constructor
********************************************************************************/
function makeMenuBar(obj,nest,vis){
nest=(!nest) ? '':'document.'+nest+'.'
this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style')
this.hideIt=b_hideIt; this.showIt=b_showIt; this.vis=b_vis
if(ie && vis) this.css.visibility='hidden'
this.state=1
this.go=0
this.height=n?this.css.document.height:eval(obj+'.offsetHeight')
this.top=b_gettop
this.obj = obj + "Object"; eval(this.obj + "=this")
}
//Get's the top position.
function b_gettop(){
var gleft=(n) ? eval(this.css.top):eval(this.css.pixelTop);
return gleft;
}
//The functions for showing and hiding
function b_showIt(){
this.css.visibility="visible"
}
function b_hideIt(){
this.css.visibility="hidden"
}
function b_vis(){
if(this.css.visibility=="hidden" | | this.css.visibility=="hide") return true;
}
/********************************************************************************
Checking if the page is scrolled, if it is move the menu after
********************************************************************************/
function checkScrolled(){
if(!oMenu.go)oMenu.css.top=(!oMenu.state)?eval(scrolled):eval(scrolled)
if(n) setTimeout('checkScrolled()',30)
}
/********************************************************************************
Inits the page, makes the menu object, moves it to the right place,
show it..
********************************************************************************/
function menuBarInit(){
oSub=new Array()
//Change it here if you want more or less submenus.
oSub[0]=new makeMenuBar('divSub0','divBg',1)
oSub[1]=new makeMenuBar('divSub1','divBg',1)
oSub[2]=new makeMenuBar('divSub2','divBg',1)
oSub[3]=new makeMenuBar('divSub3','divBg',1)
oSub[4]=new makeMenuBar('divSub4','divBg',1)
//Moving menuBar
oMenu=new makeMenuBar('divBg')
scrolled=n?"window.pageYOffset":"document.body.scrollTop"
oMenu.css.top=eval(scrolled)
oMenu.css.visibility='visible'
if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();
}
/********************************************************************************
Shows and hides the submenus
********************************************************************************/
function extract(num){
if(hideAll){
for(i=0;i<oSub.length;i++){
if(num!=i) oSub[i].hideIt()
}
}
!oSub[num].vis()?oSub[num].hideIt() Sub[num].showIt();
}
onload=menuBarInit;
</script>
</head>
<body bgcolor="White">
<div id="divBg">
<table width="102%" border="0" cellspacing="0" cellpadding="5" align="CENTER" valign="MIDDLE">
<tr bgcolor="#000000">
<font face="ocr a extended"><td height="30"><a href="#" onmouseover="extract(0); return false">Choice 1</a></td>
<td><a href="#" onmouseover="extract(1); return false">Choice2</a></td>
<td><a href="#" onmouseover="extract(2); return false">Choice 3</a></td>
<td><a href="#" onmouseover="extract(3); return false">Choice 4</a></td>
<td><a href="#" onmouseover="extract(4); return false">Choice 5</a></td>
</tr>
</font>
<!-- If you don't want submenu, just remove this tr and
remove the onclicks above and change the #'s to links -->
<tr>
<td valign="TOP">
<div id="divSub0" class="clSub">
<!-- To make the links link somewhere, just replace the #'s
with the link location -->
<a href="#">Sub Choice</a> <br>
<a href="#">Sub Choice</a><br>
</div>
</td>
<td valign="TOP">
<div id="divSub1" class="clSub">
<a href="#">Sub choice 1</a> <br>
<a href="#">Sub choice 2</a><br>
<a href="#">Sub choice 3</a>
</div>
</td>
<td valign="TOP">
<div id="divSub2" class="clSub">
<a href="#">Sub choice 1</a> <br>
<a href="#">Sub choice 2</a>
</div>
</td>
<td valign="TOP">
<div id="divSub3" class="clSub">
<a href="#">Sub choice 1</a> <br>
<a href="#">Sub choice 2</a><br>
<a href="#">Sub choice 3</a><br>
<a href="#">Sub choice 4</a><br>
<a href="#">Sub choice 5</a>
</div>
</td>
<td valign="TOP">
<div id="divSub4" class="clSub">
<a href="#">Sub choice 1</a> <br>
<a href="#">Sub choice 2</a><br>
<a href="#">Sub choice 3</a><br>
<a href="#">Sub choice 4</a>
</div>
</td>
</tr>
</table>
</div>
Enjoy!
Jack Michaelson posted this at 14:56 — 18th January 2000.
He has: 1,733 posts
Joined: Dec 1999
thanks (I think)
[This message has been edited by Jack Michaelson (edited 18 January 2000).]
Vincent Puglia posted this at 19:53 — 19th January 2000.
They have: 634 posts
Joined: Dec 1999
Hi,
Looked it over a little, pretty nice (some typos). Have you seen the one at www.javascripts.com? Not that different.
Vinny GrassBlade: cut&paste javascript
Where the world once stood
the blades of grass cut me still
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.