Custom onbeforeunload traitment

N

nicolas.hilaire

Hi all,

I just want to define my own confirm box to ask before a changing page.

For now, i'm doing this :

---------------------------------------
function myFunc()
{
return "Leave or Stay ?";
}
<body onbeforeunload="return myFunc()">
---------------------------------------

And this gives me a confirm box with "OK" button and "Cancel" button.

I want to keep this functionnality, but i'd like to desing my own
confirm box. I first want to change the caption of the button (for
example "Leave" and "Stay"), and why not, having a beautiful confirm
box with layer and div ...

Is it possible ? and how ?

Thanks a lot for you help

Nicolas H.
 
A

ASM

I don't find any Q/R or example to show me if it's possible or not :(

My IE (5.2 Mac) doesn't know 'onbeforeunload'
My FF display a box (in Fr)
- telling me I'm leaving a page
- adding something like :
Do you really want to leave ? if yes hit [OK]
else hit [Cancel]
- with your 'Leave or Stay' in middle


You can't modify alert or confirm boxes (except with IE Win, I think)

perhaps :
You may have a hidden, absolute div pretty styled as you like
and on leave event make it visible, trying to move it in center window
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top