Answer the question
In order to leave comments, you need to log in
How to implement date subtraction function with mouseover/out in js?
How to implement a function in js that records dates on mouseover and mouseout on any link in html, and subtracts the first one from the second one (In fact, find out the time the mouse spent over the link)?
I found something similar, on learn js, but I just can’t convert it to my task:
function mouselog(event) {
let d = new Date();
text.value += `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()} | ${event.type} [target: ${event.target.id}]\n`.replace(/(:|^)(\d\D)/, '$10$2');
text.scrollTop = text.scrollHeight;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question