wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes java script problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

java script problem

kanumuri koti
Greenhorn

Joined: Apr 05, 2006
Posts: 6
Hi everyone

I have a data grid and 2 buttons on a page, when a user cancels the window, i want to displat a popup asking the whethere they are sure they want to cancel.

i currently have

<SCRIPT>
function SaveChanges()
{
event.returnValue = "You will loose all unsaved changes, please update details before closing the window.";
}
</SCRIPT>



i call this function on the body like

<body bgColor="#ffffff" MS_POSITIONING="GridLayout" onbeforeunload="SaveChanges()">



Problem is, this message comes up even when clicking the buttons on the page, which is wrong, i want it to happen only when the user closes/cancels the window. Please help
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Moving to JavaScript forum...


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Please do not post in multiple forums....

Closing this topic: Post continues here: http://www.coderanch.com/t/119150/HTML-JavaScript/java-script

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java script problem