473,626 Members | 3,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling of the page when body onbeforeunload event is generated

<script>
function checkFormStatus (oForm)
{
if(isDirty(oFor m))
//event.returnVal ue = "You have entered form Data without
submitting this form.";
{
alert("You have entered form Data without submitting this
form.");
}
else { return true;}
}
var bSubmitted=fals e;

function isDirty(oForm)
{
if(bSubmitted) return false;
/*var iNumElems = oForm.elements. length;
for (var i=0;i<iNumElems ;i++)
{
var oElem = oForm.elements[i];
if ("text" == oElem.type)
{
if (oElem.value != oElem.defaultVa lue) return true;
}
}*/
var str;
str=window.docu ment.URL;
str=str.toLower Case();
if(str.indexOf( "orderstatu s") 0)
{
window.self.loc ation.href="htt p:\\arun54\rame shwargspc\doted it
\testPrintableP DF.asp";
return false;
}
else
{
return true;
}
}
</script>
<body bgcolor="E6EAF2 "
onbeforeunload= "javascript:if( checkFormStatus (document.forms[0]));">

May 22 '07 #1
1 2002
ra********@gmai l.com said the following on 5/22/2007 8:59 AM:
<script>
<snipped lots of wrapped code>

Was there a question in there?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 22 '07 #2

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

Similar topics

4
4079
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is dependant on data collected in the code behind on the server. I have set AutoPostback to false for the controls and added lines such as cboMyCombo1.Attributes.Add("onchange", "MyCombos_OnChange('1')"); in the Page_Load event, which is rendered OK...
9
2276
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx) as a popup using either window.open or window.showModalDialog. Since I want to warn the users of my application when they try to close page1.aspx and have changed the values in the meantime I thought about using the “onbeforeunload” event of the...
6
2078
by: Frank Esser | last post by:
Hallo, I've got a project with about 10 pages. On each of them the user can do data changes (mostly datagrid interactions; the datagrids are bound to datasets). The user is able to jump to each page of my project without clicking on the "save" button and he can also close the browser without saving. My customer wants the user to be informed about loss of data. If any page is left without saving data changes then on the same page a...
7
2152
by: wrytat | last post by:
Is there a way to check whether the user has confirmed all his items in a shopping cart when he is closing the browser? Then if he hasn't confirm the items, the system can prompt him to confirm the items and let him choose to close the browser or to confirm the items. Thank you.
2
5748
by: M B HONG 20 | last post by:
Hi all - I am developing an ASP.NET (C#) application and need some help. I wish to call a server-side function (in the code-behind "file.aspx.cs") upon a user clicking on the "X" to close the browser window. Is there a way to postback and call a server-side function when this happens? I am aware of the browser's native "onunload" event, but am not certain that what I'm looking for is actually possible. Any help would be greatly...
0
1492
by: WB | last post by:
Hi, How can I add an "onbeforeunload" event to the body tag of the MasterPage? All pages in my site follow a MasterPage and some of these pages require long processing. I'd like to show a "Processing. Please wait" message for these pages and need to add an "onbeforeunload" event to the body tag like so: <body onbeforeunload="ShowProcessingMessage();"> How can I accomplish this? Do I use the "Attributes.Add()" method?
1
9739
by: lee_youjin | last post by:
I needed to defect when the user is clicking the IE X button ( top right). so I could execute the cleanup function. I was able to detect it using onbeforeunload event. Now I need to call the function in code behind from onbeforeunload event call. but that is where I have a problem... please refer my code below
4
1932
by: windandwaves | last post by:
Hi Folk On one of my sites, I have a reather involved page (searchable map). When the person leaves the page then all the AJAX generated information is lost. Is there a way that I can retain all this data in a cookie or so or how would you recommend I saved all the users information (perhaps using a database on the serverside). Any recommendations greatly appreciated.
13
5647
by: Gouri.Mahajan7 | last post by:
Hello, Can anybody please tell me how to trap the browser close event. when that is fired I want to call the web method. Thanks in advance. Regards, Gouri.
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8638
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
8505
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
7196
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 projectplanning, coding, testing, and deploymentwithout 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...
1
6125
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
4092
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
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
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
1511
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.