Jump to content

O.T.: variable and Javascript Question


erich.wanker

Recommended Posts

Hello,

 

i want to run the "function bunload" if variable "closechecker" is 1

 

i have in Mainform/Script:

function bunload() 

{
if (closechecker = 1) {dontleave="MountainOffice"; return dontleave;}
};


onbeforeunload = bunload;

 

 

on startup i set in Mainform the closechecker on 1 ...

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
UniSession.AddJS('var closechecker = 1;');...

if user clicks a "Mail-Button" .. then i set closechecker = 0 ... start creating mail .. and set closechecker = 1 

procedure TMainForm.Something to Click(Sender: TObject);
begin
UniSession.AddJS('closechecker = 0;');
 UniSession.AddJS('window.location.href="mailto:wanker@domain.com"');
UniSession.AddJS('closechecker = 1;');...

but the "function bunload"  is allways "active" ...

can someone finde my mistake ?

 

thanX

erich

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...