?
Solved

<table> / onmouseout() problems!!!!

Posted on 2003-02-26
9
Medium Priority
?
346 Views
Last Modified: 2006-11-17
Ive been having some trouble when trying to create a right click menu.  Everything works fine, the only problem occurs when i try to hide the menu(table).  It should disappear 'onmouseout()', but instead it disappears when the cursor leaves the first cell!  

I'm actually trying to modify some code i got from exp-ech earlier on today!

------------
Output = "<table class = 'rightmenu' onmouseout = 'divHide()'>";
for (x=0; x<children.length; x++)
  {
   Output = Output + "<tr class = 'rightmenucelloff' onclick = " + unescape("%22") + "location.href = '" + address[x] + "'" + unescape("%22") + " onmouseover = " + unescape("%22") + "this.className='rightmenucellon'" + unescape("%22") + " onmouseout = " + unescape("%22") + "this.className='rightmenucelloff'" + unescape("%22") + "><td>" + names[x] + "</td></tr>";
          }                    
Output = Output + "</table>";

document.getElementById('second').innerHTML = rightmenu;
------------
0
Comment
Question by:Dean OBrien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:neongrau
ID: 8028290
Hi!

i can't run the code fragment correctly here.

but i suggest to put a div around your table like this

Output = "<div id='table'><table class = 'rightmenu' onmouseout = 'divHide()'>";
for (x=0; x<children.length; x++)
 {
  Output = Output + "<tr class = 'rightmenucelloff' onclick = " + unescape("%22") + "location.href = '" + address[x] + "'" + unescape("%22") + " onmouseover = " + unescape("%22") + "this.className='rightmenucellon'" + unescape("%22") + " onmouseout = " + unescape("%22") + "this.className='rightmenucelloff'" + unescape("%22") + "><td>" + names[x] + "</td></tr>";
         }                    
Output = Output + "</table></div>";

and put the div's id into your divHide() function instead.

if you can't get that to work please post the divHide() function.

regards
~neongrau
0
 
LVL 12

Author Comment

by:Dean OBrien
ID: 8029300
Thanks neon,  As it is the table is created dynamically, then replaces the code within the <div = 'second'> tags each time the right button is clicked.  

I'll try hiding the whole 'second' div as you say, it seems a good idea.  However, will have to do it the morra as code etc is at work!

If it doesnt work i'll post the divHide() function, thanks again.

easy

0
 
LVL 2

Expert Comment

by:neongrau
ID: 8031725
i completey forgot:
the onMouseout event has to be placed in the new surrounding div then!

but i think you already know :-)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Author Comment

by:Dean OBrien
ID: 8032268
Neon, i tried putting placing the onmouseout() in the div tag, but still no joy!

If you could have a look at the script, its shown here
 http://www33.brinkster.com/hefc/menucode.html , the generated output is actually called 'secondOutput' not 'output'  which is shown above.

The Div section is;

<div style="display:none; position:absolute; z-index:10;left:0; top:0;" id="second" onmouseout="divHide();"> <p>blah blah</p></div>
 
Cheers!

Any idea's would be much appreciated!

0
 
LVL 12

Author Comment

by:Dean OBrien
ID: 8032338
Neon, i tried putting placing the onmouseout() in the div tag, but still no joy!

If you could have a look at the script, its shown here
 http://www33.brinkster.com/hefc/menucode.html , the generated output is actually called 'secondOutput' not 'output'  which is shown above.

The Div section is;

<div style="display:none; position:absolute; z-index:10;left:0; top:0;" id="second" onmouseout="divHide();"> <p>blah blah</p></div>
 
Cheers!

Any idea's would be much appreciated!

0
 
LVL 2

Expert Comment

by:neongrau
ID: 8032710
can you provide a link to the full page?

i can't read the functions logic from the pure javascript code.

i need to see where each function is called.

~neongrau
0
 
LVL 12

Author Comment

by:Dean OBrien
ID: 8032883
neon, heres a link to the full site.

http://www34.brinkster.com/hefc2/Psychology/index.html

 Follow;

    Unit1 -> Developmental Psychology

then try right click!(hope your using IE).  Should work, i've removed the onmouseout() altogether, any ideas on where to put it.  I might even have to go about it different way!

easy
0
 
LVL 2

Accepted Solution

by:
neongrau earned 200 total points
ID: 8033329
hi again!

put this at the end of your script:

var to;

and adjust your div to:
<div onMouseout="to=window.setTimeout('divHide()',100)" onMouseover="window.clearTimeout(to);" style="b...

that should do the trick.

~neongrau
0
 
LVL 12

Author Comment

by:Dean OBrien
ID: 8033425
works a treat, thanks a million!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question