0

I would like to know, how can I write to file a data from JavaScript. I have a HTML with two buttons and in JavaScript I count the time between clicking of them. And I need variable "difference" write and save to a file to PC. I have not got server. How could I do that? Thanks

JavaScript

function startButton() {
startTime = Date.now(); }

function stopButton() {
if (startTime) {
    var endTime = Date.now();
    difference = endTime - startTime;
    alert('Reaction time: ' + difference + ' ms');
    startTime = null;
} else 
    alert('Click the Start button first'); }
matisetorm
  • 857
  • 8
  • 21
Erko
  • 55
  • 1
  • 1
  • 7
  • 1
    Take a look to: http://stackoverflow.com/questions/13405129/javascript-create-and-save-file – Rumpelstinsk Apr 03 '17 at 08:59
  • Possible duplicate of [Javascript: Create and save file](http://stackoverflow.com/questions/13405129/javascript-create-and-save-file) – Douwe de Haan Apr 03 '17 at 09:27
  • Thanks, but I have 5 html files with start and end buttons. That's experiment with tasks and I need to get time how long the participant makes this task. All these times (from all HTMLs) I need to write to one file. It should be automatically without a participant's actitvity to download. – Erko Apr 03 '17 at 09:32

0 Answers0