I am new to web development and I am learning to use HTML, CSS, JavaScript, jQuery and AngularJS to make a simple web application. I have a simple problem but I cannot find a simple answer to it.
I have a simple HTML code, in which I have multiple variables that are keeping track of the number of clicks that are made on different positions on the screen, i.e. one variable keeps track of the number of clicks on an image, one variable keeps track of the number of clicks on the right of the image etc.
How can I simply save the values of those variables to an Excel file? I have found very complicated ways to save arrays to Excel, but I was wondering if there is any simpler way to do that! here is a simplified version of the code, I would like to save the values of the variables "goal" and "miss":
<html>
<head>
<title>Exercise</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<body>
<img id="myImage" src="ball.gif">
<style>
#myImage { position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin:auto; }
</style>
<p id = "myGoals"></p>
<p id = "myMisses"></p>
<script>
var goal=0;
var miss=0;
var img = document.getElementById("myImage");
var width = $(img).width();
var height = $(img).height();
$(document).ready(function() {
document.addEventListener("click", function(e) {
var offset = $(img).offset();
if (e.target === img) {
goal++;
}
else {
miss++
}
document.getElementById("myGoals").innerHTML = "Goals: " +goal;
document.getElementById("myMisses").innerHTML = "Misses: " +miss;
}, false);})
</script>
</body>
</html>