473,382 Members | 1,357 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,382 software developers and data experts.

popup menu questions

PJ6
On doubleclick of a table cell, I want to pop up a menu just under it. Right
now I've only figured out how to get the cursor position, I'd like whatever
element that pops up to be directly under the cell... can't seem to get a
workable left or height value.

Also, I've found 2 methods for hiding elements - one is to set the innerHTML
of a placeholder to different items in hidden divs, the other is to
physically move elements to negative coordinates. I'm leaning towards the
second solution because it's the simplest, and my menus need to float over
existing elements anyway. Will using negative coordinates to hide elements
work OK in most browsers?

TIA,
Paul
Sep 9 '05 #1
4 1601
ASM
PJ6 wrote:
On doubleclick of a table cell, I want to pop up a menu just under it. Right
now I've only figured out how to get the cursor position, I'd like whatever
element that pops up to be directly under the cell... can't seem to get a
workable left or height value.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html><head>
<style type="text/css">
td { position: relative }
td span { display: none; position: absolute; background: #ffc;
border:1px solid red; padding: 4px; margin-top: 4px;
white-space: nowrap;}
td.iepop span { margin-top: 20px; }
td:hover span, td.iepop span { display: block }
</style>
<script type="text/javascript">
function pop(what) {
what.className = what.className==''? 'iepop' : '' ;
}
function init() {
var T = document.getElementsByTagName('TD');
ie = !!document.getElementsByTagName
&& !!document.getElementsByTagName('*')
&& !!document.getElementsByTagName('*').length
&& document.getElementsByTagName('*')[0].tagName=='!';
if(ie)
for(var i=0;i<T.length;i++) {
T[i].onmouseover= function() {pop(this)};
T[i].onmouseout= function() {pop(this)};
}
}
onload=init;
</script>
</head><body>
<table width=200 border=1>
<tr>
<td width=50%> one
<span>This is a popup<br>to see what it is<br>possible with CSS
</span>
</td>
<td> two
<span>This is an other popup, once more to see<br>
what css can make possible
</span>
</td>
</tr>
</table>
</body>
</html>

--
Stephane Moriaux et son [moins] vieux Mac
Sep 9 '05 #2
PJ6 wrote:
On doubleclick of a table cell, I want to pop up a menu just under it. Right
now I've only figured out how to get the cursor position, I'd like whatever
element that pops up to be directly under the cell... can't seem to get a
workable left or height value.
How are you attempting to get access to them? Search for
getComputedStyle (Mozill et al) and currentStyle (IE) - be prepared for
some messy code.

<URL:http://www.quirksmode.org/dom/getstyles.html>
Also, I've found 2 methods for hiding elements - one is to set the innerHTML
of a placeholder to different items in hidden divs, the other is to
physically move elements to negative coordinates. I'm leaning towards the
second solution because it's the simplest, and my menus need to float over
existing elements anyway. Will using negative coordinates to hide elements
work OK in most browsers?
Maybe, but the bestr way is to toggle the display attribute between ''
(empty string) and 'none'. 'none' takes the element completely out of
the flow, so it is as if it wasn't in the page at all. '' (empty
string) allows the display attribute to be returned to the default (it
may not have been 'block' or any other particular value).

Some suggest toggleing between 'block' and 'none', but don't be fooled.

TIA,
Paul

--
Rob
Sep 9 '05 #3
PJ6
I like this approach but the popups tend to get overwritten by the other
cells - I can't seem to get the <SPAN> element to pay attention to any
z-index I give it, looks like it's inheriting the z-index from the
containing <TD> element. Is there any way to make a <SPAN> always on top of
any cell, even if it's contained within one?

Paul

"ASM" <st*********************@wanadoo.fr.invalid> wrote in message
news:43**********************@news.wanadoo.fr...
PJ6 wrote:
On doubleclick of a table cell, I want to pop up a menu just under it.
Right now I've only figured out how to get the cursor position, I'd like
whatever element that pops up to be directly under the cell... can't seem
to get a workable left or height value.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html><head>
<style type="text/css">
td { position: relative }
td span { display: none; position: absolute; background: #ffc;
border:1px solid red; padding: 4px; margin-top: 4px;
white-space: nowrap;}
td.iepop span { margin-top: 20px; }
td:hover span, td.iepop span { display: block }
</style>
<script type="text/javascript">
function pop(what) {
what.className = what.className==''? 'iepop' : '' ;
}
function init() {
var T = document.getElementsByTagName('TD');
ie = !!document.getElementsByTagName
&& !!document.getElementsByTagName('*')
&& !!document.getElementsByTagName('*').length
&& document.getElementsByTagName('*')[0].tagName=='!';
if(ie)
for(var i=0;i<T.length;i++) {
T[i].onmouseover= function() {pop(this)};
T[i].onmouseout= function() {pop(this)};
}
}
onload=init;
</script>
</head><body>
<table width=200 border=1>
<tr>
<td width=50%> one
<span>This is a popup<br>to see what it is<br>possible with CSS
</span>
</td>
<td> two
<span>This is an other popup, once more to see<br>
what css can make possible
</span>
</td>
</tr>
</table>
</body>
</html>

--
Stephane Moriaux et son [moins] vieux Mac

Sep 12 '05 #4
ASM
PJ6 wrote:
I like this approach
It was a very simple way of doing
(with css)
but the popups tend to get overwritten by the other
cells -
Yes ... try that :

td:hover span, td.iepop span, span:hover {
display: block;
z-index: 100;
}

wich fixes the problem (except with IE)
I can't seem to get the <SPAN> element to pay attention to any
z-index I give it,
Ha Ha ... your little tricks can't bother IE :-)
It does too the same with hidden/visible forms
but, I think, a hack would exists.
As IE is soon to send to garbage ... is there very usefull to bother
about this little trouble ?

I had to create a special JS with very special IE detection
to set to each td some rollover functions
that any other browser needs ...
Delete the JS then IE will let us quiet with no more semi visible layer.
looks like it's inheriting the z-index from the
containing <TD> element. Is there any way to make a <SPAN> always on top of
any cell, even if it's contained within one?


You can heavyer try to get position of mouse (see examples below)
then at this position to get back a layer displayed
on top of html in absolute somewhere outside of window

but ... in pure css it will not be possible
and you will need JS for all navigators (caramba ! beurk !)
(the trick I gave works without JS, if the navigator isn't IE)


examples :
on-mouse-over :
http://perso.wanadoo.fr/stephane.mor...lle_layers.htm
on-click :
http://perso.wanadoo.fr/stephane.mor...yers_click.htm

--
Stephane Moriaux et son [moins] vieux Mac
Sep 13 '05 #5

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

Similar topics

2
by: ouech | last post by:
hi, i finally tryied with a popup menu but i have a problem. i popup it with TrackMenuPopup and i create it from a ressource. but it doesn't look as it should. i d'ont have the names of the...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
2
by: SamSpade | last post by:
I use to get popup events when I checked out the menu coding. That was a while ago. Something I did in the interim must have suppressed those events because I just noticed I don't get them any...
2
by: Mamatha | last post by:
Hi I don't know,is it correct form to post my query,but any know i want to clarify my query. I want to add a popup menu to Outlook from VB6.How can i add? please give me the solution. ...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
3
by: RahimAsif | last post by:
I am writing an application that requires the a portion of the main menu to be dynamic. The menu has file, panels, view files and help across the top. The view files sub menu needs to be...
9
by: john | last post by:
In Paradox I was able to create popup menu's in which some of the items had popup menu's themselves. I've looked for threads on popup menu's and access but I can't find how to make a simple popup...
5
by: SQACSharp | last post by:
I'm trying to automate an action in Internet Explorer.... I'm trying to click an image that open a popup menu. The html code of the iimage look like like <img blabla..OnClick="ShowMenu()"/> I...
2
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.