floating menu on mouseover script

DHTML scripts DHTML script
 

DHTML script
categories

Animation
Background
Bookmarks
Buttons
Calculators
Cookies
Data handling
E-mail
Enhancements
Forms
Image rotation
Menus
Messages
Miscellaneous
Music
Password protection
Redirection
Scrollers
Tables
Time & date
Windows

Publishers

Add script
Account login

 

Home > Scripts > DHTML scripts & JavaScripts > Menus > Floating menu on MouseOver

 

Floating menu on MouseOver

AUTHOR: Ron Grafe
TYPE: Freeware
BROWSERS: IE 4+, IE 5+, IE 6+, NS 4+, NS 6+

This script allows you to pop open a link menu by placing your mouse over any tag that supports the MouseOver event. You can set a timer for the window auto close, and easily define the positioning, the style and the links of the popup boxes.


EXAMPLES

 

1) Insert this script in the <HEAD> section of the page.

then copy (CTRL-C) & paste (CTRL-V)

 

2) Insert the following code with the script inside the <BODY> section of the page.

then copy (CTRL-C) & paste (CTRL-V)

 

3) Insert this line of code inside the <A> </A> tags of a link on the page that opens the popup box.

then copy (CTRL-C) & paste (CTRL-V)

4) Define the content to appear inside the popup boxes in this section of the script:

// Define the title for each box using text or images

var titleArray = new Array
titleArray[1]="<b>DHTML Scripts</b>"
titleArray[2]="<img src='http://simplythebest.net/images/smallhome.gif' border='0'>"

// Define the content for each array. Make sure you use a += after the first line of a link in an array.

var linkArray = new Array
linkArray[1]="• <a href='dhtml_menu_scripts.html'>DHTML menus</a><br>"
linkArray[1]+="• <a href='dhtml_animation.html'>DHTML animation</a><br>"
etc..

linkArray[2]="• <a href='shareware.html'>Shareware & Freeware</a><br>"
linkArray[2]+="• <a href='scripts/scripts.html'>Scripts library</a><br>"
etc..

5) Assign for each popup window the size, the positioning, the style and the timer of the popup window in this section of the code:

<a href="Javascript:Void(0)" onmouseover="setObj(1,130,100,'topL','#d5e9ea','#e6f1f2','black','red')" onmouseout="timer(2)">DHTML Scripts</a>

The order of each variable in the onMouseOver event is:

array number  width height relative positioning to the link background color title box
background color
content box
background color
title text color content text color timer
has to match with the titleArray[#] and linkArray[#] decimal
value
decimal
value
topL = top-left
topR = top-right
bottomL = bottom-left
bottomR = bottom-right
#number
or
color name
#number
or
color name
#number
or
color name
#number
or
color name
#number
or
color name
set the number of seconds before closing

6) You can further modify the style of the tables and the font for the text and links inside the popup boxes in this section of the script (make sure to use single quotes inside double quotes):

text="<table width='"+(winWidth-4)+"' height='"+(winHeight-4)+"' border='0' bgcolor='"+tableColor+"' cellspacing='0' cellpadding=1>"
text+="<tr><td width='"+(winWidth-4)+"' height='20' align='center' valign='top' bgcolor='"+headerColor+"'>"
text+="<font face='arial,helvetica' color='"+tcolor+"' SIZE='-1'>"+titleArray[value]+"</font>"
text+="</td></tr>"
text+="<tr><td width='"+winWidth+"' align='left' valign='top'>"
text+="<font face='verdana,helvetica' color='"+bcolor+"' SIZE='-2'>"+linkArray[value]+"</font>"
text+="</td></tr></table>"

And in this section of the script (in the BODY section):

<layer name="nsviewer" bgcolor="#cccccc" width=0 height=0 style="border-width:thin;z-index:1"></layer>
<script language="JavaScript1.2">
if (iens6){
document.write("<div id='viewer' style='background-color:#cccccc;marginleft:0;visibility:hidden;position:absolute;width:0;height:0; z-index:1;overflow:hidden'></div>")

7) Optional: insert the onClick event handler inside the <BODY> tag as follows:

<body onClick="stopIt()", followed by other tags such as bgcolor, etc..

This is optional, use this tag if you want the popup box to disappear when one clicks anywhere inside the open page.

copy (CTRL-C) & paste (CTRL-V)


For more information you can visit
Ron Grafe's web site.


[BACK] [TOP]

 

BLOGS - BOOKMARKS - FONTS - FRIENDS - GAMES - HEADLINES
MUSIC - PIXELS - SCRIPTS - SOFTWARE - SOUNDS - WEB SEARCH

 


Copyright © 1997-2008 SimplytheBest Inc. Legal Disclaimer.
All copyrights acknowledged. All rights reserved.