aspose file tools*
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic

java script problem

kanumuri koti

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

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

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

Joined: Apr 14, 2004
Posts: 10336

Moving to JavaScript forum...

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Eric Pascarello

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

Closing this topic: Post continues here:

jQuery in Action, 2nd edition
subject: java script problem