[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Javascript fct works as required in IE 7 but not in Safari 3.3.2 or Firefox 3.5.3

Asked by andynic_nl in JScript, Safari Web Browser, Firefox Web Browser

Tags: javascritp, safari, firefox, html

The function shown below works perfectly for Inetenet Explorer 7 but not for Safari 3.2.2 or Firefax 3.5.3
 Can anyone tell me what I need to add to get it to work for Safari and FireFox?
 Thanks for you help
 Andynic
PS: I'm a newbie in this area, and need would appreciate hand-holding here.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
function processOnBeforeUnload()
     {
       // The purpose of this function is to prevent the user from leaving a screen where changes
       // could potentially be lost.
       // 
       // At this writing, there is no provision for keeping track if an actual change was made.
       // but better that than lose a number of changes.
       // 
       // Each page that requires this protection (for example the main menu page (MM) does not, whereas
       // manage galleries update confirm (UGC) does) the <body> tag must contain
       // onBeforeUnload="processOnBeforeUnload()"
       //
       // On each of those pages, each button that can cause the user to leave the page, requires
       // onClick=setButtonClicked("the button's name") which sets global variable GVbttnClkd
 
alert ("in processOnBeforeUnload");
 
       var msg = "NOTA BENE:\\n" +
	         "If you have changed data on this page and do not want to lose the changes \\n" +
	         "then click \\"Cancel\\". \\n\\n" +
	         "Otherwise click \\"OK\\" to continue to the next page (i.e. continue the selected action).";
       
       // Excluded buttons:
       //
       // For page UGC (see beginning of gfrm.cgi for the list of abbreviation meanings
       if ( GVbttnClckd == "REback"           ) { return; }
       if ( GVbttnClckd == "UGCcancelUpdate1" ) { return; }
       if ( GVbttnClckd == "UGCcancelUpdate2" ) { return; }
 
       var event = event || window.event;       
       // the if part works exactly as it should for Internet Explorer 7
       if (event) 
       {
         event.returnValue = msg;
       }
 
//    ??? else // Need something here for Safari 3.2.2 and Firefox 3.5.3
//       {
//        ??????????
//         confirm (msg); //puts message up but clicking either "OK" or "cancel" takes user to the next page
//         return msg; // Does nothing.
//       }
     }
 
Related Solutions
Keywords: Javascript fct works as required in IE …
 
Loading Advertisement...
 
[+][-]09/26/09 10:21 AM, ID: 25430446Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/28/09 09:25 AM, ID: 25440693Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/28/09 09:28 AM, ID: 25440719Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625