On Fri, 10 Oct 2003 09:53:11 -0400, Jamie Jackson
<wa***************@bigfoot.com> wrote:
On Fri, 10 Oct 2003 00:31:24 +0100, bengee
<po********@localhost.localdomain> wrote:
Jamie Jackson wrote: So, if they click on any of the nav buttons in the header/nav bar,
they need to get an alert:
"Would you like to continue without saving your changes?"
_Yes_ _No_
<body onunload="if (confirm('Save changes?')) { doSomethingHere(); }">
Great! It still requires me to modify the application framework, but
at least it's only in one place (good news). :)
I think this isn't going to work. AFAIK, by the time you get the
confirmation, you've already unloaded the page, and are halfway to the
next. Is there a way to prevent the unLoad from continuing, when the
user confirms in the negative?
I'm racking my brain trying to figure out how to do this without
retrofitting all of the nav links.
I think I may be on to something with the following, would someone
please let me know if I'm going in the right direction, or if there's
an easier way, or if there's a solution to the onUnload issue above?
function changeLinks(d) {
// this picks up all the links but those in my popup nav :-( ...it's
a start, though
for (var i=0; i < d.links.length; i++) {
// maybe save each link's old location into an array here, for
later use
// now, rewrite each link to a confirm. later, code the following
to load a new window with the old url?
d.links[i].href = "javascript
: confirm('Exit before saving?')";
}
}
changeLinks(document);
Thanks,
Jamie