beforeunload

U

UKuser

Hi,

I have the following script which I'm trying to make work:

<head>
<script>
window.onbeforeunload =
if (!document.forms['f4'].elements['Continue'].value==true;){
function() {
return("This will take you back to the login page.");
}
}
</script>
</head>

In short I want to alert a user when they leave the page unless they
click the button Continue.

I'm sure this is quite simple, and will work on it. Will post the
solution if I find it.

Thanks

A
 
E

Evertjan.

UKuser wrote on 23 aug 2007 in comp.lang.javascript:
I have the following script which I'm trying to make work:

<head>
<script>
window.onbeforeunload =
if (!document.forms['f4'].elements['Continue'].value==true;){
function() {
return("This will take you back to the login page.");
}
}
</script>
</head>

In short I want to alert a user when they leave the page unless they
click the button Continue.

I'm sure this is quite simple, and will work on it. Will post the
solution if I find it.

Do you have a question?
 
U

UKuser

UKuser wrote on 23 aug 2007 in comp.lang.javascript:


I have the following script which I'm trying to make work:
<head>
<script>
window.onbeforeunload =
if (!document.forms['f4'].elements['Continue'].value==true;){
function() {
return("This will take you back to the login page.");
}
}
</script>
</head>
In short I want to alert a user when they leave the page unless they
click the button Continue.
I'm sure this is quite simple, and will work on it. Will post the
solution if I find it.

Do you have a question?

Yes - how can I achieve this?? How can I alert the user when they
leave a page, unless they click the Continue button.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
legroups.com>, Thu, 23 Aug 2007 01:25:53, UKuser
if (!document.forms['f4'].elements['Continue'].value==true;){
^^^^^^
That's a sign of inadequate programming comprehension.
function() {
return("This will take you back to the login page.");

Will it? Can you be sure that the so-called "login page" would be
reached? What if the user enters "www.humgrummit.com"?
 

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

Forum statistics

Threads
474,159
Messages
2,570,883
Members
47,414
Latest member
djangoframe

Latest Threads

Top