473,761 Members | 7,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fucntion delay not working

Hi,

I am trying to create this rollover bar menu with js and it works
fine until it has to disappear I wanted it to disappear after the
mouseout function and after a little delay but instead it disappears
right away. Here is the whole code, any suggestions will be helpful


<html>
<head>
<style type="text/css">
/*div.horbar { display:block; white-space:nowrap;
text-transform:capit alize; height: auto; margin: 0 0 0 0; }
ul.horbar_menu { display: block; background-color:#fff; color:#fff;
font-size:100%; margin: 0 0 0 0; padding:0 0 0 0;}
ul.horbar_menu li { display:inline; margin: 0 0 0 0; padding:0 0 0 0;
text-align:center; border-width: thin; border-style: hidden;}*/
/*ul.horbar_menu li a { text-decoration: blink; padding:0 0 0 0;}
ul.horbar_menu li.divlyn { margin:0 0 0 0; padding:0 0 0 0; border: 0
hidden; background-color:#000; color:#000;}*/
ul.horbar_subme nu { display: none; font-weight: normal; margin: 0;
padding:0 ; text-align:center; }
ul.horbar_subme nu li { display:inline; margin:0; padding:0;
text-align:center; border:0;}
ul.horbar_subme nu li a { text-decoration:unde rline; padding:0 1px 0
1px; text-align:center;}
ul.horbar_subme nu li.divlyn { margin:0; padding:0; border:0 solid;
background-color:#000; color:#000;}
/*#horbar_menu1, #horbar_menu1 li a { background-color:#fff;}
ul.horbar_menu li a:hover { background-color:#ee0 !important;
color:#300 !important;} - For changing the main menu */
#horbar_submenu 0 { background-color:#fff; color:#000;}
#horbar_submenu 1, #horbar_submenu 1 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#900;
color:#eff;}
#horbar_submenu 2, #horbar_submenu 2 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#090;
color:#fef;}
#horbar_submenu 3, #horbar_submenu 3 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#009;
color:#ffe;}
#horbar_submenu 4, #horbar_submenu 6 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#620;
color:#000;}
#horbar_submenu 5, #horbar_submenu 4 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#451;
color:#fff;}
#horbar_submenu 6, #horbar_submenu 7 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#985;
color:#fff;}
#horbar_submenu 7, #horbar_submenu 5 li a { font: Verdana, Arial,
Helvetica, sans-serif; font-size:11px; background-color:#359;
color:#fff;}
ul.horbar_subme nu li a:hover { background-color:#fff !important;
color:#21559c !important;}
a:link {text-decoration: none;}
a:visited {text-decoration: none;}
a:hover {text-decoration: none;}
a:active {text-decoration: none;}
</style>
<script type="text/javascript" xml:whitespace= "preserve">
var intLastSubMenu = new Number(7);
var elmSubMenu = new Object();
function subMenuShow(int Which) {
for (var i=0;i<=intLastS ubMenu;i++) {
elmSubMenu = document.getEle mentById('horba r_submenu'+i);
if ((typeof elmSubMenu != "undefined")&&( elmSubMenu!=nul l)) {
elmSubMenu.styl e["display"] = ((i==intWhich)? "block":"none") ;
}
}
return false;
}
function subMenuHide(int Which) {
for (var i=0;i<=intLastS ubMenu;i++)
{
elmSubMenu = document.getEle mentById('horba r_submenu'+i);
if ((typeof elmSubMenu != "undefined")&&( elmSubMenu!=nul l)) {
elmSubMenu.styl e["display"] = ((i==intWhich)? "none":"non e");
}
}
return false;
}
setTimeout("sub MenuHide()", 1000);
</script>
</head>
<body>
<table width="628" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="628"><di v class="horbar">
<!-- main menu -->
<a href="#" onMouseOver="su bMenuShow(1)">< img
src="images/aboutUS.jpg" width="73" height="28" border="0"></a><a
href="#" onMouseOver="su bMenuShow(2)">< img src="images/Calendar.jpg"
width="134" height="28" border="0"></a><a href="#"
onMouseOver="su bMenuShow(3)">< img src="images/resources.jpg"
width="76" height="28" border="0"></a><a href="#"
onMouseOver="su bMenuShow(4)">< img src="images/pedagogy.jpg" width="72"
height="28" border="0"></a><a href="#"
onMouseOver="su bMenuShow(5)">< img src="images/publications.jp g"
width="92" height="28" border="0"></a><a href="#"
onMouseOver="su bMenuShow(6)">< img src="images/discussion.jpg"
width="123" height="28" border="0"></a><a href="#"
onMouseOver="su bMenuShow(7)">< img src="images/search.jpg" width="58"
height="28" border="0"></a>

<!-- submenus -->
<div onMouseOut="sub MenuHide()">
<ul class="horbar_s ubmenu" id="horbar_subm enu1" >
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports</a> |
<a href="#" type="text/html" title="?">Locat ion Hours</a> |
<a href="#" type="text/html" title="?">Conta ct Us</a></li></ul>

<ul class="horbar_s ubmenu" id="horbar_subm enu2">
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports </a> |
<a href="#" type="text/html" title="?">Locat ion Hours </a>|
<a href="#" type="text/html" title="?">Conta ct Us</a></li></ul>

<ul class="horbar_s ubmenu" id="horbar_subm enu3">
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports</a> |
<a href="#" type="text/html" title="?">Locat ion Hours</a> |
<a href="#" type="text/html" title="?">Conta ct Us</a></li></ul>

<ul class="horbar_s ubmenu" id="horbar_subm enu4">
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports</a> |
<a href="#" type="text/html" title="?">Locat ion Hours</a> |
<a href="#" type="text/html" title="?">Conta ct Us</a></li></ul>

<ul class="horbar_s ubmenu" id="horbar_subm enu5">
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports</a> |
<a href="#" type="text/html" title="?">Locat ion Hours</a> |
<a href="#" type="text/html" title="?">Conta ct Us</a></li></ul>

<ul class="horbar_s ubmenu" id="horbar_subm enu6">
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports</a> |
<a href="#" type="text/html" title="?">Locat ion Hours</a> |
<a href="#" type="text/html" title="?">Conta ct Us</a></li></ul>

<ul class="horbar_s ubmenu" id="horbar_subm enu7">
<li><a href="#" type="text/html" title="?">Welco me Message</a> |
<a href="#" type="text/html" title="?">CETL Staff</a> |
<a href="#" type="text/html" title="?">CETL Board</a> |
<a href="#" type="text/html" title="?">Missi on Goals</a> |
<a href="#" type="text/html" title="?">Facul ty Associates</a> |
<a href="#" type="text/html" title="?">Annua l Reports</a> |
<a href="#" type="text/html" title="?">Locat ion Hours</a> |
<a href="#" type="text/html" title="?">Conta ct
Us</a></li></ul></div></div></td>
</tr>
</table>
</body></html>
Thx in advance.
Ricky
Jul 23 '05 #1
1 1606

"Ricky" <in**@djricky.c om> wrote in message
news:9a******** *************** ***@posting.goo gle.com...
Hi,

I am trying to create this rollover bar menu with js and it works
fine until it has to disappear I wanted it to disappear after the
mouseout function and after a little delay but instead it disappears
right away. Thx in advance.
Ricky


Another problem you have is that doing this:
<div onMouseOut="sub MenuHide()">
hides your menu on all mouseout events associated with the contained links.
It's OK to hide the menu after a delay, provided that any pending delay is
cancelled by all subsequent mouseovers within the div.

Add this code to your script:

var smTimer=null;

function smDelay(action)
{
clearTimeout(sm Timer);
if(action==true )
smTimer=setTime out("subMenuHid e()",1000);
}
Then in *both* div tags, place these statements:

onmouseover='sm Delay(false)'; onmouseout='smD elay(true)'

This should give the functionality you wanted, however your functions are
compatible only with relatively recent browsers.

--
Stephen Chalmers
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2500
by: Harlin Seritt | last post by:
I am working on making something called a PopMsg widget which is actually identical to a Balloon widget from Pmw. Here is the code: ---code--- from Tkinter import * import time class PopMsg: def showmsg(self, event):
4
18884
by: Shuo Xiang | last post by:
Greetings: I'm working on some graphical game and need to animate certain things (by continuously changing the x/y coordinate and update the display), however, the system is blinkingly fast so no actual animations can be seen. Therefore I need a "delay" function. Is there a "delay" function in C++ that accepts a time argument in seconds or its varieties (i.e. so that I don't have to resort to the "big for loop" scheme). Regards,
14
18832
by: Des L. Davis | last post by:
System: Dell PowerEdge Server with 3 GB RAM, 2.4 GHz Celeron Software: Microsoft SQL Server 2000 Enterprise running on Windows 2003 Server Software: Microsoft SQL Server 2000 Enterprise running on Windows 2000 Server If you run the code below, you'll notice something odd occuring. The MilliSecond value does not change after a 1Millisecond delay. Is this a bug or am I doing something wrong? Any assistance will be greatly appreciated
11
21255
by: Maheshkumar.R | last post by:
Hi groups, How i can introduce some milliseconds delay in application. How i can do achieve this... let me clearly say... (1) I'm displaying slices of medical images. For framerate - for this i'm loading 2+ slices, 4+ slices in loop to have cine impact..-> Ok working (2) But if i want to reduce the speed...how i can introduce delay inbetween
7
2943
by: mfeingold | last post by:
I am working on a system, which among other things includes a server and a ..net control sitting in an html page and connected to the server. I ran into a couple of problems, you guys might have some insight about. 1) It takes 20 sec or so to open a tcp socket from the client to the server. It just sits in the TcpClient.conect waiting for something. When I run the same control from a windows application it connects right away and works...
18
3269
by: Max | last post by:
This is a follow-up on my previous thread concerning having the program wait for a certain date and time and then executing some code when it gets there. My question is; can I use the Sleep function from kernel32 to accomplish this? My concern is that this function takes milliseconds where my program needs to be accurate to within 5 minuets, and delays may be as long as a number of days, months or whatever. Would I run into many problems...
3
2628
by: nj609eagle | last post by:
Recently and without warning, a report that I was using in my VB.NET 2003 application started to take 10 minutes to load. It also take thisamount of time to open in the deisgner. I'm using a ADO.NET XML file as the datasource, so there is no network traffic. Loking at the task manager, my CPU is low, and the memory isn't changing. I have two laptops and anyone off my network can open this report up without the long delay.
2
1291
by: taaz | last post by:
I'm developing the Delay Audiometry feedback. My Step are... Recording -> Playing... these are on different events. I've used the mcisendstring()for manipulation of audio & made the functions For Recording I used ======================================================= Dim settings As String Dim Alignment As Integer
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.