erich.wanker Posted December 5, 2014 Share Posted December 5, 2014 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 Quote Link to comment Share on other sites More sharing options...
zilav Posted December 5, 2014 Share Posted December 5, 2014 JavaScript is not Pascal, replace if (closechecker = 1) with if (closechecker == 1) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.