473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

setTimeout, Onmouseout

Hi,

I have created a very simple way of using a floating menu. I created an
Absolute positioned DIV tag, with ID menunews (There will be others) and the
status hidden.

This is called by

<a href="javascript:;"
onMouseover="document.getElementById('menunews').s tyle.visibility='visible'"

News</a>

Because of the multiple menu ID's I want to time out the menu, so I had set
the following in the DIV Tag

<div id="menunews" onmouseout="el=this;setTimeout
('el.style.visibility=\'hidden\'',1500)" >

However this has the drawback that if the DIV tag is not hovered over the
script does not work. Can the setTimeout be included in the <a> link?

Any and all help much appreciated.

P.

May 24 '06 #1
1 2174
Paul Davies wrote:
Hi,

I have created a very simple way of using a floating menu. I created an
Absolute positioned DIV tag, with ID menunews (There will be others) and the
status hidden.

This is called by

<a href="javascript:;"
What is the point of an A element where the href attribute contains an
empty statement? A much better idea is to put something useful in there:

<a href="news.html" onclick="return false;" ...>News</a>

onMouseover="document.getElementById('menunews').s tyle.visibility='visible'"
And for browsers that don't support getElementById or don't have
scripting enabled?

>

News</a>


There are hundreds, if not thousands, of drop-down menus available on
the web - some use pure CSS with no scripting at all. Googling "HTML
CSS drop-down menus" returns about 2,000,000 hits.

The better ones will continue to be functional even if scripting and CSS
are not available.

Because of the multiple menu ID's I want to time out the menu, so I had set
the following in the DIV Tag

<div id="menunews" onmouseout="el=this;setTimeout
('el.style.visibility=\'hidden\'',1500)" >

However this has the drawback that if the DIV tag is not hovered over the
script does not work. Can the setTimeout be included in the <a> link?


Yes, but the canceling and re-setting logic gets quite convoluted -
there are simpler solutions. Users generally expect something to happen
immediately when they click on or mouseover/out some element, using
setTimeout to delay a response by 1.5 seconds may cause confusion and
frustration.
--
Rob
Group FAQ: <URL:http://www.jibbering.com/faq/>
May 25 '06 #2

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

Similar topics

1
by: Mike | last post by:
Hey, I posted a question yesterday that was pretty confusing. I've figured out some of it for myself, but there's still one issue that I can't figure out, and I've been trying for months now! ...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
2
by: Athanasius | last post by:
Could someone shed some light as to why the following setTimeout function will not work on the Mac IE5.2? It does however work on PC(Forefox,Netscape,IE) & Mac(Safari,Firefox). Here is the script,...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
2
by: M. Fisher | last post by:
I have a line in my html file as following: <div id="selectBox" class="selectbox" onclick="$ ('PostMark_Pa4440a_SelectCol_1').toggle();" onmouseout="setTimeout('$...
4
by: Adam Risser | last post by:
Hi everyone, I am modifying the suckerfish dropdown code to use settimeout to have a slight pause before the menus disappear to make it more user friendly. I have hit a snag with the following...
11
by: David | last post by:
Hi, I'm trying to set a delay for an onmouseout function on a simple list menu. I don't understand why the code below doesn't work. If on the onmouseout I use ( this.className="hide"; ) it hides...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.