lema Posted November 1, 2011 Share Posted November 1, 2011 Hi to all. How can I get into a Delphi variable the result of a JavaScript function like getTimezoneOffset() ? I can successfully execute the following and get the result on caption of UniLabel1 UniSession.AddJS( 'var d = new Date(); ' + 'var _offset = (d.getTimezoneOffset() / 60 ) * -1; ' + 'TestForm.UniLabel1.setText(_offset); ' ); Regards. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 3, 2011 Administrators Share Posted November 3, 2011 It can be done using an Ajax request: UniSession.AddJS( 'var d = new Date(); ' + 'var _offset = (d.getTimezoneOffset() / 60 ) * -1; ' + 'ajaxRequest(MainForm.form, "mycall", ["ofs="+_offset]); ' ); procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName='mycall' then begin UniLabel1.Caption:=Params.Values['ofs']; end; end; 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.