473,803 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BODY onBlur event?

Hi, I'm having some trouble with the "onBlur" event in the BODY tag.
Ideally, what I want to happen is that when someone leaves window A,
window A executes a command. I had put

<body onBlur="savePag e();">

I have a couple of problems. On IE 6 (win2000), whenever I put the
cursor focus on a textfield within window A, the "savePage" function
is invoked. And on Mozilla Filefox 0.9.1, the event never launches
even when I leave the window.

Does anyone know how I can solve these respective problems?

Thanks in advance, - Dvae
Jul 23 '05 #1
2 3733


D. Alvarado wrote:
I'm having some trouble with the "onBlur" event in the BODY tag.
Ideally, what I want to happen is that when someone leaves window A,
window A executes a command. I had put

<body onBlur="savePag e();">

I have a couple of problems. On IE 6 (win2000), whenever I put the
cursor focus on a textfield within window A, the "savePage" function
is invoked. And on Mozilla Filefox 0.9.1, the event never launches
even when I leave the window.


For Mozilla you might want to use
window.onblur = function (evt) {
savePage();
}
that should work with IE too but of course the original problem is not
solved by that, namely that exactly one object can have the focus
meaning when you focus on some object in the window the window looses
focus and thus the onblur handler is called. One way to try to work
around that is to have
var tid;
window.onblur = function (evt) {
tid = setTimeout('sav ePage();', 20);
}
and then to make sure that every element in the page that can get the
focus cancels the timeout e.g.
<input type="text" onfous="clearTi meout(tid);">

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
DU
D. Alvarado wrote:

Ideally, what I want to happen is that when someone leaves window A,
window A executes a command.


Then coding the body onblur is definitively not best. Depending on what
is your webpage context, design requirements, etc., coding/resorting to
onbeforeunload event (which is supported by NS 7.2, Mozilla 1.6+, MSIE
6) might be what you need. Here, we don't even know if window A is a
script-initiated window or a non-script initiated window nor which type
of command.

DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.3 :)
Jul 23 '05 #3

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

Similar topics

4
6350
by: Rithish Saralaya | last post by:
Does the tab key override the onblur event? I have a text field whose input I validate on blur, and set the focus back again if invalid. Effectively, I do not want the user to move out of the control unless the data entered is validated. This works fine, when I try to click on some other control. However, on tabkey press, the onblur does get fired, but the focus also moves onto the next control. It gives a user experience of hopping onto...
4
7605
by: Peloux | last post by:
Hi, I have written some htc in order to validate data in a form. most of htc are attached on 'onblur' event. Now, we would like to use the Enter Key to sublit form, so we use the following code : ----------- <SCRIPT> function touche_EnterKeyPress(){
6
7330
by: rob | last post by:
Hi I'm trying to create a "roll-up" effect when a window loses focus and then "roll-down" when it regains focus. This statement works properly with every browser I can get my hands on EXCEPT WinIE6. WinIE6 says there's an error in the code, but the debugging info says the problem is on line 1 char 1, which are comments. <Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
5
7600
by: Dave Hammond | last post by:
Hi All, I have a web form which performs certain actions upon moving focus away from a field. However, if the user clicks the top corner 'X' icon to close the window, the onBlur event still fires. If, for example, the onBlur event was an alert() popup: when the user clicks the close window icon, the window closes and then the alert pops up. Clearly, if the user closed the window, there is no point to performing the onBlur event.
2
3143
by: Suresh | last post by:
Can anybody tell me that whether Mozilla supports onBlur event? I tried onBlur event with IE5 and also with Mozilla. But Mozilla is not supporting. Please give me a solution. Regards Suresh.
1
2441
by: suresh_nsnguys | last post by:
Hi, i am displaying google.com website inside a frame with frameset setting onblur="self.focus();". but when i am trying to enter some text in google search box,the text is not getting displayed. when i remove this 'onblur' event handler from frameset.the text is getting displayed in search box. i don't want to remove the 'onblur' event handler and i want keyboard interaction with frames.is there any way to achieve it.
2
2765
by: John Kotuby | last post by:
Hi all, I am integrating some 3rd party grids into a large ASPX form page in VS 2008 using VB. I have 4 different grids on the page. The object is to not allow the user to leave a grid if he/she is in the middle of editing a row and has not selected the button to "save" the changes to the client-mode grid. BTW, none of these "changes" are actually saved to the database until the entire page is posted back (I am not using Callbacks on...
4
1983
by: chiru | last post by:
hi i have attached onblur event to document body. but at run time when i move out of one text box to another text box in that doc its not firing the event. please help
9
2099
by: aashishn86 | last post by:
Hi!! i want to validate a list box onthe onblur event and if no value is selected , display a message on the left using <span> and innerHTML here's what i have written <html> <head> <script type="text/javascript">
0
9699
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
10542
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...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
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
7600
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
5496
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
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
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.