Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to stay at the current page without reloading?
Message
De
02/02/2007 21:25:17
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
How to stay at the current page without reloading?
Divers
Thread ID:
01192067
Message ID:
01192067
Vues:
83
Hi all,

I have a javascript running whenver the form's onunload event fires. The javascript will popup a confirm box to ask user whether to stay at the current page or redirect to somewhere else.

Howoever, when I use " window.location.href = window.location.href ", the page will be reloaded, which some changed values on the form will be missing. Therefore, I added a hash, window.location.href = window.location.href + "#", but it's not working. I have tested with " __doPostBack('__Page', '') ", but somehow it's not working in some forms. Is there a way to stay at the page without reloding the page? Thanks.

Here is my javascript:
function onPageUnload()
{   
     var result = confirm("Do you want to leave the page?")
     if (result)
         window.location.href = window.location.href
     else
         windwo.location.href = "./Logout.aspx"
}
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform