473,785 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onMouseOver and onMouseOut problem in Cell <TD> containing Writing

Hi

I was trying to create a page where a SubMenu would appear when the
user moved the mouse over an item of a Menu (= Table Cell <TD>).
Unfortunately there seems to be a problem; the onMouseOver event is
fired as soon as the mouse enters the cell but then the onMouseOut
event is fired when it is moved over the writing inside the cell. The
browsers seem to consider that the writing is not part of the cell.

After a lot of waisted time I realised that Microsoft has a way of
solving this problem by using onMouseEnter and onMouseLeave (instead
of onMouseOver and onMouseOut) but this doesn't work for either
Netscape or Opera (as I suppose it's JScript).

Are there any Javascript event handlers that do the same trick as
onMouseEnter and onMouseLeave? If not I suppose this is a bug, has
anyone found a clean way to fix this?

I suppose a way to fix this would be to replace the table with an
image and do the event handling on the image instead of on the table
cell. But I really would rather not use images.

Here is the code in case my explanation was not clear enough.

<TR>
<!--<TD ALIGN="center" onMouseOver="di splaySubMenu('r ealEstate',1);"
onMouseOut="clo seSM = 1;setTimeout('c loseSubMenu()', 500);">-->
// THE onMouseOver AND onMouseOut EVENTS ARE FIRED TOO OFTEN EACH
TIME THE MOUSE ENTERS OR EXITS THE CELL BUT ALSO WHEN IT PASSES OVER
THE H2 FONT

<TD ALIGN="center" onMouseOver="di splaySubMenu('r ealEstate',1);"
onMouseLeave="c loseSM = 1;setTimeout('c loseSubMenu()', 500);">
// THIS CODE WORKS BUT ONLY IN INTERNET EXPLORER (I used IE6)

<H2 CLASS="red">Cal l</H2><H2 CLASS="yellow"> SubMenu</H2>
<H2 CLASS="blue"> >></H2>
</TD>
</TR>

Thanks in advance to anyone who can help.
Jul 20 '05 #1
1 8366
I seem to have answered my own question. The problem I had was that I
thought that there was a sort of border zone between the cell and the
font where the cell's onMouseOut event had fired but the font
onMouseOver had not yet fired but that is not the case. It's either in
one or the other of the two items <TD> or <DIV>. So in fact it's quite
easy to fix. You just need to create a control variable
"stillInMenuCel l":

<SCRIPT LANGUAGE="Javas cript">

function closeSubMenu() {
if (!stillInMenuCe ll)
subMenuLayerNam e.style.visibil ity = 'hidden';
}

</SCRIPT>
<TD ALIGN="center" onMouseOver="st illInMenuCell = 1;
displaySubMenu( 'realEstate',1) ;"
onMouseOut="sti llInMenuCell = 0; closeSubMenu(); ">
<DIV ID="realEstateC ell" onMouseOver="st illInMenuCell = 1;">
<H2 CLASS="red">Rea lEstate</H2><H2 CLASS="yellow"> Ads</H2>
<H2 CLASS="blue"> >></H2>
</DIV>
</TD>

I really have the impression that this is a bug. From reading the
recommendations for onMouseOut I really had the impression it should
only be fired if the Mouse actually left the Cell area. Anyway I
managed to find a fix for it so never mind.
Jul 20 '05 #2

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

Similar topics

4
6645
by: A.S. | last post by:
Hi, I have the following simple code: <TABLE><TR> <TD BGCOLOR="#FFFFFF" ONCLICK="myform.color.value = this.bgcolor">hello</TD> </TR></TABLE> <FORM ACTION="hello.cgi" NAME="myform" ID="myform">
0
689
by: Matt Adams | last post by:
I want to move the following <PRE> defintion to a css file: <TABLE><TR><TD><PRE>sample text</PRE></TD> <TD> not predefined font</TD></TR></TABLE> should be <TABLE><TR><TD class=aaa>sample text</TD> <TD> not predefined font</TD></TR></TABLE>
2
11230
by: js | last post by:
I have a table rendered with XSLT. The first column has a radio button controls for user to make a selection for a particular row. All the values in the remaining columns are all concated with a &#xA0; (blank). I need to retieve the text in each cell of that row if the radio button on that row is clicked. Each <TD> has a numeric ID so that I can use it with document.getElementById().innerText method. I use Javascript to assign some...
2
5781
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
5
116810
by: Derek Fountain | last post by:
I have a horizontal navigation bar, which is a single row table containing the right images. It "stretches" itself across the screen using a penultimate td like this: <td width="100%" background="images/nav_bar/nb_spacer.gif">&nbsp;</td> which works in all major browsers that I've tried, but doesn't validate. No background attribute to the td tag, apparently. What is the correct way to do this? A stylesheet entry with a
3
1707
by: RC | last post by:
I have a very sime html table like <html><head><title>My Table</title> <style> input { margin: 0; padding: 0; border-width: 0; text-indet: 0; text-align: left } </style></head><body> <table border="1" width="100%"> <caption>Table Title</caption> <tr>
5
2938
by: mahesr | last post by:
I want to match some particular text between <tr>and </tr> or <td>and </td>.... in PHP. like below............ <table><tr> CATEGORY: <td><font face="Verdana" size="1" color="#A000A0"> Wedding Accessories
4
5263
George Lft
by: George Lft | last post by:
I'm new at building table. Mostly PHP programming . Now I can't seem to fix the size of my table row and column. Any idea? <h4>Two rows and three columns:</h4> <table border="1"> <tr> <td>10000000000000</td> <td>200</td> <td>300</td> </tr> <tr>
7
2795
by: Xiaoyan | last post by:
Hi,everyone: I have a problem now. I can't get the information between the <tr><td> and </td></tr>. for example: I use this regular expression can't get it, I don't know why. $test=~/<tr><td>(.*)<\/td><\/td>(.*)<\/td><\/tr>/ms; <tr><td>station</td> <td>station number/identification, see chart above: <br> B = GoMoos buoy B location<br> S = New Scantum at the southern edge Jefferys Ledge</td></tr>.
0
9647
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
9491
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,...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10104
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,...
0
9959
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7510
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
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
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.