Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2003-02-26
9
Medium Priority
?
367 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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

564 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