473,703 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Key events in invisible (by -Moz-Opacity) div (Mozilla)


Hello,

I cannot succeed in getting any key event on a div that's been set
invisible by the style's MozOpacity property under firefox. I'm using
this method so that I can capture the mouse events. Unfortunately, it
appears to do so only with mouse events, not key events.

Is there a better solution than the following? :
-----------------------------
<html>
<head>
<title>Event test..</title>
</head>
<body>

<div style="border: 3px solid green;">
<div id="foo">
</div>
</div>

<script>
var foo = document.getEle mentById ("foo");
foo.style.MozOp acity = 0;
foo.style.filte r = "alpha(opacity= 0)";
foo.style.backg roundColor = "red";
foo.style.width = "100%";
foo.style.heigh t = "100px";
foo.onmouseover = function () {alert ('over');};
foo.onmouseout = function () {alert ('out');};
foo.onkeydown = function () {alert ('down');};
</script>
</body>
</html>
-----------------------------

As you'll notice, the mouse events will be fired, but not the key*
events.
Note: The code works under IE (I can reach the same effect as the
'MozOpacity' property by the 'filter' property)

Many thanks for any advice!

Best regards,
Arnaud
--
Arnaud DIEDEREN
Software Developer
IONIC Software
Rue de Wallonie, 18 - 4460 Grace-Hollogne - Belgium
Tel: +32.4.3640364 - Fax: +32.4.2534737
mailto:ad@ionic soft.com
http://www.ionicsoft.com
Aug 1 '06 #1
2 3214
Arnaud Diederen (aundro) wrote:
Hello,

I cannot succeed in getting any key event on a div that's been
set invisible by the style's MozOpacity property under firefox. ...
<snip>
<html>
<head>
<title>Event test..</title>
</head>
<body>

<div style="border: 3px solid green;">
<div id="foo">
</div>
</div>

<script>
<snip>
</script>
</body>
</html>
-----------------------------

As you'll notice, the mouse events will be fired, but not the key*
events.
<snip>

There is nothing in this page that can have the keyboard focus so how
do you expect it to capture key events at all? But in any event, the
bubbling of key events would be from children to their parent, and so
on up, so only events originating with descendants of your invisible
DIV could be captured by it, and they would presumably be hidden
themselves.

Richard.

Aug 1 '06 #2


Arnaud Diederen (aundro) wrote:

I cannot succeed in getting any key event on a div that's been set
invisible by the style's MozOpacity property under firefox. I'm using
this method so that I can capture the mouse events. Unfortunately, it
appears to do so only with mouse events, not key events.
<div id="foo">
</div>
var foo = document.getEle mentById ("foo");
foo.style.MozOp acity = 0;
foo.onkeydown = function () {alert ('down');};
I don't think Mozilla fires any key events on div elements, whether you
apply any CSS opacity or not. You would need to have a child or
descendant element inside of the div that can receive key events (e.g.
<input type="text"or <textarea>), then that event might bubble up to
the div if someone types in a text control and can be handled in the
div's key event handler.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 1 '06 #3

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

Similar topics

12
2892
by: Joseph Misko | last post by:
I am on WinXP. The following page works perfectly in IE6. For Netscape 7.0, I have to move off of the image and then back on to get the fade to take effect, and with Mozilla (latest version) a series of close mouseovers will cause the screen to go wacko. Does anyone have input on how to get Netscape/Mozilla to work with a fade like this? Thanks!
11
2022
by: Saqib Ali | last post by:
Please excuse me, this is a fairly involved question that will likely require you to save the file below to a file and open it in a browser. I use Mozilla 1.5, so the problem I describe below should be reproducible with that version at least. BACKGROUND: =========== When you open this page in your browser, you will see a 4 cell table. The cells contain the following items respectively:
2
9503
by: gene | last post by:
I have some javascript code that displays random images in random places on the page by making changes to the document's css. This works in Safari and IE, but I can't get it to work on Mozilla. Using the javascript debugger, it seems that everything is working at that end, so I wonder if the problem is mozilla/css related. The live page is at http://www.smalltime.com/exhibitions/washanddry Here is the relevant html and javascript...
5
8220
by: Harry Gould | last post by:
To all, I'm a newbie here, so please bear with me. I develop web pages for a company intranet where Internet Explorer 6 is the standard. Now I must develop a public internet website that is browser-agnostic (i.e., works with Netscape, version 4x, 7x, etc). My question is this: I have about 10 table rows, each tagged with a class attribute (<tr class="billing" style="display:none">) that I wish to make visible or invisible in response...
1
2042
by: John Smith | last post by:
Can you tell me why Mozilla can't show some Javascript? example: function high(which2){ theobject=which2 highlighting=setInterval("highlightit(theobject)",50) } function low(which2){ clearInterval(highlighting) if (which2.style.MozOpacity)
2
3103
by: Peter Wright | last post by:
Hi all. Hopefully this should demonstrate the problem I'm having: http://flooble.net/~pete/focus-problem-demo/ (I'm testing it in Mozilla only, but I'm not sure if it's actually a Mozilla-only problem) I'm capturing the focus and blur events for the document, updating a
4
2023
by: Laurent Compere | last post by:
Hi all, I try to make a logo fade in. I wrote the code below that is simple and supposed to be compatible with IE6,Firefox and Netscape. It works pretty well under IE6 but under Firefox and Netscape, I have the same problem : It seems that the property MozOpacity doesn't want to update itself though I cand read its value with the same object reference. Can Anybody try to explain me why ? As a log, I sent several values on the status bar...
7
1571
by: Dayo | last post by:
Hello folks. Sorry if this seems a bit silly, I have no experience with this type of code. Here is a fading script for an Image Gallery I am looking to fix. It works with IE and Safari but not with Firefox and Netscape. Actually, when I say it doesn't work, I mean you have to refresh the page before the fade happens and once that is done once, it works on that image. for that session. Here is the code: // Fade In Script
5
4248
by: BibhuAshish | last post by:
Hi, I want to invisible one div. To invisible the <div> i have written like the following <div id="divid" style="display:none" > But the above code is working in IE, not in mozilla. What i need to do for that.
0
9236
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
8988
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
8946
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...
0
7839
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4415
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
4673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3108
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2416
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2047
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.