File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 15385
Please do not post in multiple forums....

Closing this topic: Post continues here:

I agree. Here's the link:
subject: java script problem
It's not a secret anymore!