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. 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now